RSASHAAESKEYMOD0101LOCKDH
Classical Cryptography

Rail Fence Cipher

The Rail Fence Cipher is a transposition cipher. It writes the plaintext in a zigzag pattern across rails and reads row by row.

Algorithm Steps

  1. 1Take plaintext input.
  2. 2Take rail depth input.
  3. 3Write characters in zigzag pattern.
  4. 4Read each rail row by row.
  5. 5Combine rows to form ciphertext.

Formula

Characters are arranged in a zigzag pattern using the selected rail depth.

Example

Plaintext: WEAREDISCOVEREDFLEEATONCE
Depth: 3
Encrypted text: WECRLTEERDSOEEFEAOCAIVDEN
Decrypted text: WEAREDISCOVEREDFLEEATONCE