railfence
Railfence, or the rail fence cipher, is a classical transposition cipher used in cryptography. It does not substitute letters but reorders them by writing the plaintext in a zigzag across a fixed number of rails (rows). After the text is laid out, the letters are read off row by row to produce the ciphertext.
Encryption involves choosing the number of rails. The plaintext is written diagonally down the rails, moving
Example: with three rails and the plaintext WEAREDISCOVER (no spaces), placing letters in a zigzag yields rail
Decryption reverses the process: given the number of rails and the ciphertext, reconstruct the zigzag pattern
Security and usage: the rail fence cipher offers little real security and can be broken by simple
History and variants: the exact origins are unclear, but the method appears in classical and later cryptography