← Back

#### Rail Fence Cipher

- Tool
- About

What-How

Welcome again.
Rail fence cipher (also called zigzag cipher) is a form of 'transposition cipher' in which the letters of the original message are scrambled resulting into a permutation. The scheme works like follows:
Suppose you want to encrypt a message: "WE ARE DISCOVERED. FLEE AT ONCE" or "WEAREDISCOVEREDFLEEATONCE", and the 'key' (or the 'rail') is 3, then, it will be written diagonally as follows:

    W . . . E . . . C . . . R . . . L . . . T . . . E
    . E . R . D . S . O . E . E . F . E . A . O . C .
    . . A . . . I . . . V . . . D . . . E . . . N . .

...and, then will be read row by row, resulting in the final ciphertext: "WECRL TEERD SOEEF EAOCA IVDEN" or "WECRLTEERDSOEEFEAOCAIVDEN".
The ciphertext can be decrypted by following a reverse process, of filling up the letters at corresponding places row by row and then reading off diagnoally.
'Railfence' is the simplest of 'transposition' ciphers. Other versions also include 'columnar ciphers' i.e. writing the message's letters in columns and reading as rows; or writing as columns and reading as rows. Different rounds of 'scrambling' or 'permutation' can also be done to further strengthen the cipher.
Next

Up yet, we have discussed various classical techniques, which all worked upon english 'letters' of the original message to give us the cipher message. But now in the modern world, the 'real' and 'industrial' encryption is done actually on 'bits' (1s and 0s) rather than the letters. The reason of this being that, in modern reality, our world is full of computers and digital stuff - the files, documents, images, videos - everything is digital, everything is binary. That's a very important accomplishment and a revolution in human history, and that's what we will discuss next in "World of Bits".
Bye till then.
:-)
Post-10 Ended.

Input String
Settings:

Key = 1

Encrypt Decrypt
done
Output String