rail-fence1

rail-fence1 - N , which you can do by brute force. Consider...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Encoding and Decoding Rail Fence Ciphers Lign 17, A. Kehler Encryption Encrypting a message with a rail fence cipher is straightforward. Say the message you want to encrypt is: This is a secret message, right? We immediately remove the spaces and punctuation, and put it in all capitals: THISISASECRETMESSAGERIGHT First, you pick your value of N . Let’s do N = 3. Right the message out vertically, wrapping around after 3 lines: TSACTSGIT HISRMSEG ISEEEARH Since we wrote it out vertically, now we paste it together horizontally: TSACTSGITHISRMSEGISEEEARH And now we have an encrypted message! Note that we could have done the opposite: writing the message out horizontally, and writing it back vertically. But we’ll always do it the first way to maintain consistency. Decryption Decrypting a message encrypted with a rail fence cipher is not very difficult. All you need to do is figure out the value of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: N , which you can do by brute force. Consider this message: RFEHAAOAAECERSBKINIREYRLCPSETE First lets try N = 2. There are 30 characters in the message, so we write the rst 15 letters on the top row, and the last 15 on the second: 1 RFEHAAOAAECERSB KINIREYRLCPSETE Now we start unwinding it vertically: RKFIENHI. .. That doesnt look too promising. So lets try N = 3. Now we have 10 characters per line: RFEHAAOAAE CERSBKINIR EYRLCPSETE Now we start unwinding it vertically: RCEFEYERR. .. Hmmm. That doesnt look too good either. Now lets try N = 4. So the rst two lines will have 8 characters, and the last two will have 7: RFEHAAOA AECERSBK INIREYR LCPSETE And again we start unwinding it vertically: RAILFENCECIPHERSAREEASYTOBREAK That is to say: Rail fence ciphers are easy to break Success! 2...
View Full Document

Page1 / 2

rail-fence1 - N , which you can do by brute force. Consider...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online