This will involve decoding a message. You will be given the encoded message. You have to try all possible keys to decode the message. For each key you try, you will print the key being tried and the decoded message. Only one of the keys will work, but you must try all of them.
The output will be written to a file rather than the screen. You can read the original message from the keyboard (not recommended), from a file or put it in the code as a string constant. Also, all character array string handling must be done using pointers, not array notation. That also means no using *(p+i) kind of substitution for p[i].
Everybody gets there own message, each encoded with a different key. Well, since there are 27 of you, some keys are reused. But the text isn't. Each message is a line from a Shakespeare sonnet. Here is a table of names and encoded strings.
Name | Message |
---|---|
Anderson,Adam | xifo jo ejthsbdf xjui gpsuvof boe nfot fzft |
Armknecht,Randy | k cnn cnqpg dgyggr oa qwvecuv uvcvg |
Atkinson,Robert | dqg wurxeoh ghdi khdyhq zlwk pb errwohvv fulhv |
Barker,David | erh psso ytsr qcwipj erh gyvwi qc jexi |
Delio,Michael | bnxmnsl rj qnpj yt tsj rtwj wnhm ns mtuj |
Erguiza,Kenneth | lkgzaxkj roqk nos roqk nos cozn lxoktjy vuyykyykj |
Eyer,Corey | klzpypun aopz thuz hya huk aoha thuz zjvwl |
Garcia,Cesar | eqbp epib q uwab mvrwg kwvbmvbml tmiab |
Giseburt,Jennifer | hnc rw cqnbn cqxdpqcb vhbnuo juvxbc mnbyrbrwp |
Goodman,Atif | rkzvi s drsxu yx droo kxn drox wi cdkdo |
Graff,Scott | wtvp ez esp wlcv le mcplv zq olj lctdtyr |
Hart,Tanner | rday egxxqz qmdft euzse tkyze mf tqmhqze smfq |
Huntington,Thomas | sbe gul fjrrg ybir erzrzorerq fhpu jrnygu oevatf |
Kowalik,Tim | hvoh hvsb w gqcfb hc qvobus am ghohs kwhv ywbug |
Kumar,Maneesh | ati iwdht lwd pgt xc upkdjg lxiw iwtxg hipgh |
Layman,William | ev fkrbys xedekh qdt fhekt jyjbui reqij |
Leon,Santiago | nyzcjk z nyfd wfiklev fw jlty kizldgy srij |
Malik, Ali | mfdggcwv xgj bgq af lzsl a zgfgmj egkl |
Navarrete,Eduardo | zkxtm ikbgvxl ytohnkbmxl maxbk ytbk extoxl likxtw |
Oldfather,Jayson | von um nby gulcaifx un nby mohm ysy |
Oloffson,Charles | viy di oczhnzgqzn oczdm kmdyz gdzn wpmdzy |
Robbins,Aaron | bkn wp w bnksj pdau ej pdaen chknu zea |
Salinas,Cristobal | qeb mxfkcri txooflo cxjlrpba clo cfdeq |
Socorro,Joey | ydrcp y rfmsqylb tgarmpgcq mlac dmgjcb |
Taglia,Christopher | hr eqnl sgd annj ne gnmntq qzydc pthsd |
Wilson,Edward | boe bmm uif sftu gpshpu gps xijdi if upjmfe |
Wolf,Brandon | vjgp jcrra k vjcv nqxg cpf co dgnqxgf |
The input is a string of characters.
The output is a table of keys and strings.
The purpose of this assignment is to practice working with strings, pointers and files.
Here is a sample run. Your output doesn't have to look exactly like this. Note that there is no output to the screen from running the program, it all goes into the file.
--> ./lab5 --> cat lab5out 0 zhofrph edfn pb iulhqgv wr wkh vkrz wkdw qhyhu hqgv 1 ygneqog dcem oa htkgpfu vq vjg ujqy vjcv pgxgt gpfu 2 xfmdpnf cbdl nz gsjfoet up uif tipx uibu ofwfs foet 3 welcome back my friends to the show that never ends 4 vdkbnld azbj lx eqhdmcr sn sgd rgnv sgzs mdudq dmcr 5 ucjamkc zyai kw dpgclbq rm rfc qfmu rfyr lctcp clbq 6 tbizljb yxzh jv cofbkap ql qeb pelt qexq kbsbo bkap 7 sahykia xwyg iu bneajzo pk pda odks pdwp jaran ajzo 8 rzgxjhz wvxf ht amdziyn oj ocz ncjr ocvo izqzm ziyn 9 qyfwigy vuwe gs zlcyhxm ni nby mbiq nbun hypyl yhxm 10 pxevhfx utvd fr ykbxgwl mh max lahp matm gxoxk xgwl 11 owdugew tsuc eq xjawfvk lg lzw kzgo lzsl fwnwj wfvk 12 nvctfdv srtb dp wizveuj kf kyv jyfn kyrk evmvi veuj 13 mubsecu rqsa co vhyudti je jxu ixem jxqj duluh udti 14 ltardbt qprz bn ugxtcsh id iwt hwdl iwpi ctktg tcsh 15 kszqcas poqy am tfwsbrg hc hvs gvck hvoh bsjsf sbrg 16 jrypbzr onpx zl sevraqf gb gur fubj gung arire raqf 17 iqxoayq nmow yk rduqzpe fa ftq etai ftmf zqhqd qzpe 18 hpwnzxp mlnv xj qctpyod ez esp dszh esle ypgpc pyod 19 govmywo lkmu wi pbsoxnc dy dro cryg drkd xofob oxnc 20 fnulxvn kjlt vh oarnwmb cx cqn bqxf cqjc wnena nwmb 21 emtkwum jiks ug nzqmvla bw bpm apwe bpib vmdmz mvla 22 dlsjvtl ihjr tf myplukz av aol zovd aoha ulcly lukz 23 ckriusk hgiq se lxoktjy zu znk ynuc zngz tkbkx ktjy 24 bjqhtrj gfhp rd kwnjsix yt ymj xmtb ymfy sjajw jsix 25 aipgsqi fego qc jvmirhw xs xli wlsa xlex riziv irhw 26 zhofrph edfn pb iulhqgv wr wkh vkrz wkdw qhyhu hqgv
I only need the .c file. You don't need to send me the executable file or the output.
ASK if you have any questions.
Or if you get error messages that you don't understand.
If you are getting stuck, call or email me.