Secrets of Cryptograpy/ProgrammingA Story by Paul RamnoraCurrently, I'm studying cryptography by reading Simon SIngh's book, called: The Cracking Code book. It contains certain cryptograms that readers can practice doing their code cracking skills on. I used QBASIC programming language to help.I'M CURRENTLY PRACTICING DOING SOME QBASIC CODING… I was just reading through a very interesting book called: The Cracking Codebook. It is written by author Simon Singh. At the back of the book; on pages: 243/244, it suggests 4 cryptograms that allows readers to practice their code cracking skills; with each one of these puzzles being increasingly more difficult to crack than was the one before it. Anyway, here is the first cryptogram which should be the easiest of the 4 to go and decode…(I will work on decoding the rest, afterwards)... CIpertext: L FDQQRW IRUHFDVW WR BRX WKH DFWLRQ RI UXVVLD LW LV D ULGGOH ZUDSSHG LQ D PBVWHUB LQVLGH DQ HQLJPD XLQVWRQ FKXUFKLOO Plaintext(translation): I cannot forecast to you the action of russia it is a riddle wrapped in a mystery inside an enigma winston churchill MY WORKING OUT METHOD The first thing I noticed about the cryptogram, is it looks like being a mixture of variable length letter words/with punctuation spaces showing in between each word. L FDQQRW IRUHFDVW WR BRX WKH DFWLRQ RI UXVVLD LW LV D ULGGOH ZUDSSHG LQ D PBVWHUB LQVLGH DQ HQLJPD XLQVWRQ FKXUFKLOO (1) 123456 12345678 12 123 123 123456 12 123456 12 12 (1) 123456 1234567 12 (1) 1234567 123456 12 123456 12345678 123456789 I also noticed that there are, at least, 3 x single letter words being included: (L/D/D). In the English language there are only 2 single letter words that I know of; and, therse are: (A/I). By a pure guess, I thought this might be a sentence quote being spoken; so, I thought it’s highly likely that the word ‘I’ is being used here to begin the sentence/and, therefore, it’s quite likely that the stand alone, L -(which is the letter that starts the ciphertext)- = I; which means that D (the only other single letter/and, which is repeated twice in the Ciphertext) = A. Next, one realises that both ‘A’/'I’ are also common vowel letters, as well; as opposed to being much rarer constant letters; thus, it’s simply a matter of replacing each L with I/and, each D with A; and, already we are making some headway towards guessing what this code is. CIpertext(original): L FDQQRW IRUHFDVW WR BRX WKH DFWLRQ RI UXVVLD LW LV D ULGGOH ZUDSSHG LQ D PBVWHUB LQVLGH DQ HQLJPD XLQVWRQ FKXUFKLOO CIpertext(after replacing each L with I/and, each D with A): I FAQQRW IRUHFAVW WR BRX WKH AFWLRQ RI UXVVIA IW IV A UIGGOH ZUASSHG IQ A PBVWHUB IQVIGH AQ HQIJPA XIQVWRQ FKXUFKIOO -(I could have tried ‘very slowly’ guessing, and, replacing even more letters; but, no, I decided to try another way which is far quicker.)- My next major guess here is that this Ciphertext is, in fact, using the Caesar Shift encoding method; which deals with alphabet letter repositioning(eg. A+1=B/A+2=C/-etc). That must mean, all I have to do to find out exactly what the Caesar Shift code number is; and, then, I will be able to discover exactly what ‘all’ of the letters in the code mean. So, having already worked out what 2 individual letters mean: L=I/D=A. I have to count what is the alphabet letter position of both L(I)/D(A)? L, which is letter 12 of the alphabet, if we count backwards to get to I…becomes I by a count of -3. (I=9/J=10/K=11/L=12). And, similarly, with D; if we count backwards to get to A….becomes A also by a count of -3. (A=1/B=2/C=3/D=4). Thus, it’s most likely that the Caesar Shift number must be -3. My next step is to test if -3 really does work/or, not? So, having already decoded the first word: L=I/I now need to decode the 6 letter length 2nd word by using the Caesar Shift number -3. FDQQRW …using Caesar Shift of -3 for each letter we get… F=6-3=3=C D=4-3=1=A Q=17-3=14=N Q=17-3=14=N R=18-3=15=O W=23-3=20=T …and, eureka! Success! It spells the english word: cannot. Thus, at this stage we’ve already managed to manually figure out that…the start of the code… L FDQQRW …means… I cannot At this point there is no need for me to try doing any further manual translation of the code; simply because computers work a hell of a lot more faster at doing this sort of thing; so time to get down to creating a computer program to do the rest of the job, automated, instead. -(NOTE: By just merely doing a few guesses to start with; I didn’t need to quite tediously try every possible Caesar Shift number ranging through from 1-26; and, consequently, the job of writing a computer program to solve the problem will be considerably shortened; simply, by already knowing that the Caesar Shift number is -3.)- ========== Pseudocode:- a) Clear screen b) Get the Caesar Shift code number (-3) c) Get the Cipertext d) Let the program do the decoding e) Printout the decoded plaintext f) Ask the user if they wished to re run the program again/or, not? If (Y)es; then, start back at step a); and, if (N)o; then, END the program. ========== QBASIC CODE For those who may be interested in what the actual program code I wrote looks like; then, here it is the full listing for you to view… QBASIC CODE LISTING/START/(122 lines)… ==================== ‘ Author: paul ramnora ‘ CREATED: 04:07 08/02/2009 GMT. ‘*** COMMENTS: This program asks the user to enter 2 items of data… ‘ A) Caesar Shift Code number: ‘ B) Ciphertext to be decoded to become plaintext ‘ Then, the program will use the above data entered ‘ NOTE: It’s possible for the program to be used to both ‘ Eg. you could enter… ‘—————————- ‘*** integer: (int/%)… intAlphabetLetterNo% = 0 ‘*** string: (str/$)… strASpace$ = ” ” ‘——————- GOSUB clearScreen GOSUB getCaesarShiftNumber GOSUB getCipherText GOSUB decodeText GOSUB printDecodedPlaintext GOSUB reRun ‘——————- clearScreen: printTitle: printUnderline: getCaesarShiftNumber: getCipherText: decodeText: printDecodedPlaintext: reRun: …QBASIC CODE LISTING/END/(122 lines) =================== Finally, if you click on the above image -(shown as being a small thumbnail size pic next to the title of this article)-; there you will see what the program RUN/screen display printout looks like. QBASIC PROGRAMMING LANGUAGE DOWNLOAD LINK If you wish to try out the above code; then, you can download the QBASIC programming language directly from Microsoft web site... http://support.microsoft.com/kb/135315 ...scroll down to where it says: Other Folder; and, next, choose the link which says: Download olddos.exe now. THE CRACING CODE BOOK INTERNET LINKS... The Cracking Code book can be brought online from amazon.co.uk(you can also follow this link to read other people's reviews): Simon Singh's own web site is at: And, it's worth noting that he has a link on his web site which allows people to either buy a teaching cryptography book on CD ROM/or else, immediately, download it entirely for FREE: http://simonsingh.net/The_CDROM.html
===== Both essay, and, also, computer screen printout created by me, Paul Ramnora. (c)copyright, Mr. Paul Ramnora, 2008/2009./All rights reserved.
© 2009 Paul Ramnora |
Stats
1749 Views
2 Reviews Added on February 9, 2009 Last Updated on September 20, 2009 AuthorPaul RamnoraLONDON, United KingdomAboutI like general arts, education, keep fit, martial arts, tv/video's/dvd's, computers and programming/-etc. more..Writing
|