rail-fence1

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

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

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 ﬁrst way to maintain consistency. Decryption Decrypting a message encrypted with a rail fence cipher is not very diﬃcult. All you need to do is ﬁgure out the value of

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

View Full Document
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 let’s 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 doesn’t look too promising. So let’s try N = 3. Now we have 10 characters per line: RFEHAAOAAE CERSBKINIR EYRLCPSETE Now we start unwinding it vertically: RCEFEYERR. .. Hmmm. That doesn’t look too good either. Now let’s 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

## This note was uploaded on 09/15/2011 for the course LIGN 17 taught by Professor Kehler during the Winter '08 term at UCSD.

### 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
Ask a homework question - tutors are online