Classical Crypto / C

Source ยป

Affine Cipher

$ ./affine-cipher.out --help
Usage: ./affine-cipher.out [OPTION]... A B [STRING]...
Encrypt and decrypt strings with a simple formula.
Example: ./affine-cipher.out -e 5 7 "Hello World!"

Options:
  -d, --decrypt    decrypt input strings
  -e, --encrypt    encrypt input strings
  -h, --help       display this help text and exit

A must be coprime of 26, default mode is encryption.

Atbash Cipher

$ ./atbash-cipher.out --help
Usage: ./atbash-cipher.out [OPTION]... KEY [STRING]...
Monoalphabetic substitution cipher.
Example: ./atbash-cipher.out -u -p bcdefghijklmnopqrstuvwxyza Hello

Options:
  -h, --help      display this help text and exit
  -p, --print     print the key and normal alphabet for comparison
  -u, --unique    check key for alphabetic uniqueness

BackwardsCipher

$ ./backwards-cipher.out --help
Usage: ./backwards-cipher.out [OPTION]... [STRING]...
Print strings backwards.
Example: ./backwards-cipher.out Hello World

Options:
  -h, --help    display this help text and exit

Caesar Cipher

$ ./caesar-cipher.out --help
Usage: ./caesar-cipher.out [OPTION]... [STRING]...
Rotate strings through the alphabet.
Example: ./caesar-cipher.out -n -r 25 "Hello 123 World!"

Options:
  -h, --help             display this help text and exit
  -s, --no-shortcut      do not use a shortcut to reduce
                         redundant rotations
  -n, --numbers          rotate numbers alongside letters
  -r, --rotations=NUM    rotate the input string NUM times;
                         defaults to one rotation

Null Cipher

$ ./null-cipher.out --help
Usage: ./null-cipher.out [OPTION]... KEY [POSITION]...

Create a ciphertext from positions of letters in a string.
Example: ./null-cipher.out "Hello World" 1 2

Options:
  -h, --help         display this help text and exit
  -i, --index=NUM    begin indexing at NUM (default: 0)
  -q, --quiet        disable warnings

Polybius Square Cipher

$ ./polybius-square.out --help
Usage: ./polybius-square.out [OPTION]... [STRING/COORD]...

Map alphabet characters to digits.
Example: ./polybius-square.out -e Hello World

Options:
  -d, --decrypt    decrypt input strings (use coordinates)
  -e, --encrypt    encrypt input strings (use strings)
  -h, --help       display this help text and exit
  -i, --i          coordinate 24 represents 'I' (default)
  -j, --j          coordinate 24 represents 'J'
  -q, --quiet      disable warnings

Tokenize With Padding

$ ./tokenize-with-padding.out --help
Usage: ./tokenize-with-padding.out [OPTION]... SIZE [STRING]...

Tokenize strings.
Example: ./tokenize-with-padding.out 2 Hello World

Options:
  -d, --delim=STR       delimiting character
  -h, --help            display this help text and exit
  -p, --padding=CHAR    specify padding character
  -q, --quiet           disable warnings