In last few articles we discussed substitution ciphers. Ie. the plain text was substituted with a different alphabet and that gave us cipher text. Rail Fence Cipher is a member of transposition ciphers family. Plain text is shuffled based on some rule a that gives us cipher text. The alphabet remains the same for both plain text and cipher text.

The rule in the case of Rail Fence Cipher is going zig zag over certain number of rows (rails).

Rail Fence Cipher - Hello World.

Rail Fence Cipher – Hello World.

The key is number of rows. The disadvantage of this cipher is a limited number of rows we can use, therefore the attacker can simply use brute force and tried all the keys to decipher the message.