encoding_decoding_railfence
Encode or decode text with the Rail Fence transposition cipher, arranging characters in a zigzag across rails. Designed for puzzles, CTFs, and educational use.
Instructions
Rail Fence Cipher (Encode / Decode). Encode or decode text with the classical Rail Fence cipher: characters are written in a zigzag down and up across a fixed number of rails, then read off row by row to encode (decode reverses the zigzag to recover the original order). This is a transposition cipher — it reorders characters rather than substituting them — and has no real cryptographic strength, so use it for puzzles, CTFs, and learning, not to protect secrets. Choose encoding_decoding_caesar or encoding_decoding_vigenere instead when you need a substitution cipher (fixed shift or keyword-driven), and pick this tool when the requirement is specifically a zigzag/rail transposition. rails must be an integer 2-50; remove_spaces strips spaces before processing. Runs locally on the input you provide: read-only, non-destructive, contacts no external service, and is rate-limited. Returns the transformed text plus a character analysis and a visual zigzag pattern.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to transform. All characters are repositioned; nothing is dropped except spaces when remove_spaces is true. | |
| operation | Yes | Whether to encode (write the zigzag, read off by rail) or decode (rebuild the zigzag to recover the original order). | |
| rails | Yes | Number of rails (rows) in the zigzag. Must be an integer 2-50. More rails increases scrambling but offers no real security. | |
| remove_spaces | No | Strip all spaces from the text before encoding/decoding. When false, spaces are kept and repositioned like any other character. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the transform succeeded. | |
| input | No | The input text, echoed back. | |
| operation | No | The operation performed (encode or decode). | |
| rails | No | The number of rails applied (2-50). | |
| remove_spaces | No | Whether spaces were stripped before processing. | |
| result | No | The transformed (encoded or decoded) text. | |
| analysis | No | Character-distribution analysis of the plaintext. | |
| pattern | No | Visual zigzag layout for display (first 50 characters). |