Vernam Cipher encoder/decoder
make && sudo make install
Usage: ./vernam [--help] [--table] [--row <row>] [--pad <pad>]
[--key <key>] [--cipher <cipher>] [--text <text>]
Flag | Notes |
---|---|
--help | Display above usage message |
--table | Generates/displays the cipher table |
--row <row> | Starting row (26 characters) of the cipher table |
--pad <pad> | Increment by row (can be positive or negative) |
--key <key> | Secret key used to encode/decode |
--cipher <cipher> | Message to decode |
--text <text> | Message to encode |
Table display for manual encoding/decoding
./vernam --row zyxwvutsrqponmlkjihgfedcba --pad -1 --table
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Azyxwvutsrqponmlkjihgfedcba
Byxwvutsrqponmlkjihgfedcbaz
Cxwvutsrqponmlkjihgfedcbazy
Dwvutsrqponmlkjihgfedcbazyx
Evutsrqponmlkjihgfedcbazyxw
Futsrqponmlkjihgfedcbazyxwv
Gtsrqponmlkjihgfedcbazyxwvu
Hsrqponmlkjihgfedcbazyxwvut
Irqponmlkjihgfedcbazyxwvuts
Jqponmlkjihgfedcbazyxwvutsr
Kponmlkjihgfedcbazyxwvutsrq
Lonmlkjihgfedcbazyxwvutsrqp
Mnmlkjihgfedcbazyxwvutsrqpo
Nmlkjihgfedcbazyxwvutsrqpon
Olkjihgfedcbazyxwvutsrqponm
Pkjihgfedcbazyxwvutsrqponml
Qjihgfedcbazyxwvutsrqponmlk
Rihgfedcbazyxwvutsrqponmlkj
Shgfedcbazyxwvutsrqponmlkji
Tgfedcbazyxwvutsrqponmlkjih
Ufedcbazyxwvutsrqponmlkjihg
Vedcbazyxwvutsrqponmlkjihgf
Wdcbazyxwvutsrqponmlkjihgfe
Xcbazyxwvutsrqponmlkjihgfed
Ybazyxwvutsrqponmlkjihgfedc
Zazyxwvutsrqponmlkjihgfedcb
Encode a message
./vernam --row zyxwvutsrqponmlkjihgfedcba --pad -1 --key test --text attackatdawn
Output:
gcogelhndvlt
Decode a message
./vernam --row zyxwvutsrqponmlkjihgfedcba --pad -1 --key test --text gcogelhndvlt
Output:
attackatdawn
Read more about the Gilbert Vernam and his cipher (one-time pad).