Tools to decrypt/encrypt Rail Fence automatically. Rail Fence cipher is a transposition cipher consisting in writing a text in zig-zag and read it from left to right.
Rail Fence (Zig-Zag) Cipher - dCode
Tag(s) : Transposition Cipher
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Tools to decrypt/encrypt Rail Fence automatically. Rail Fence cipher is a transposition cipher consisting in writing a text in zig-zag and read it from left to right.
Rail Fence Encryption uses an integer for the number of levels of the zigzag.
The encoded message is written in zig-zag (like a rail fence/sawtooth) along a path with N levels/floors.
Example: Encrypt DCODEZIGZAG with N=3 is writting
D---E---Z-- |
-C-D-Z-G-A- |
--O---I---G |
The cipher message is read by rows.
Example: The encrypted message is DEZCDZGAOIG
RailFence decryption requires to know the number of levels N.
Example: Decrypt the message DEZCDZGAOIG with N=3
Write the expected zigzag form and complete it by lines, before reading as zig zag
Example:
X---X---X-- |
-X-X-X-X-X- |
--X---X---X |
D---E---Z-- |
-C-D-Z-G-A- |
--O---I---G |
Example: The original plain text is DCODEZIGZAG.
A message encoded by Rail-Fence has an index of coincidence equal to that of the language of the original text.
Frequency analysis reveals usual occurrences of common letters similar to a plain text.
Rail Fence can be cracked by testing all levels from 2 to N. Use the Brute-force attack button.
There are several variations:
- The fence may begin with a peak or a hollow (up or down).
Example: A...E
.B.D.
..C.. (↘↗ hollow)
Example: ..C..
.B.D.
A...E (↗↘ peak)
- The first letter is not necessarily the base of the peak or hollow, the zig zag can start in the middle (equivalent to add spaces at the beginning)
Example: ....D.
.A.C.E
..B... (One shift)
- It is possible to allow the spaces and punctuation, which shifts the characters.
None, Rail Fence is the original word, ZigZag is the mnemonic term.
No date is recognized.
dCode retains ownership of the online 'Rail Fence (Zig-Zag) Cipher' tool source code. Except explicit open source licence (indicated CC / Creative Commons / free), any algorithm, applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (PHP, Java, C#, Python, Javascript, Matlab, etc.) no data, script or API access will be for free, same for Rail Fence (Zig-Zag) Cipher download for offline use on PC, tablet, iPhone or Android !
Please, check our community Discord for help requests!