This program implements the Vigenère cipher, a method of encrypting and decrypting texts using a repeating key.
This program requires Python 3.
To run the program, use the following command:
python cipher_tools.py [operation] [options]
operation
: The operation to perform. Must be one ofencode
,decode
, orreversekey
.--alphabet
,-a
: The alphabet to use. Required for all operations.--key
,-k
: The key for the cipher. Required forencode
anddecode
operations.--plaintext
,-p
: The plaintext. Required forencode
andreversekey
operations.--ciphertext
,-c
: The ciphertext for the cipher. Required fordecode
andreversekey
operations.
To encode a message using the Vigenère cipher:
python cipher_tools.py encode -a ABCDEFGHIJKLMNOPQRSTUVWXYZ -k HELLO -p HELLO
To decode a message using the Vigenère cipher:
python cipher_tools.py decode -a ABCDEFGHIJKLMNOPQRSTUVWXYZ -k HELLO -c IFMMP
To find the key for a Vigenère cipher using the plaintext and ciphertext:
python cipher_tools.py reversekey -a ABCDEFGHIJKLMNOPQRSTUVWXYZ -p HELLO -c IFMMP
This repository also includes a tool for generating a lookup table for ciphers. To use the tool, run the following command:
python3 table_generator.py [ALPHABET] [IMAGE]
ALPHABET
: The alphabet to generate a table for.IMAGE
: A boolean value indicating whether or not to generate an image. Optional.
To generate a lookup table for the alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
python3 table_generator.py ABCDEFGHIJKLMNOPQRSTUVWXYZ
To generate a lookup table for the alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ" and an image:
python3 table_generator.py ABCDEFGHIJKLMNOPQRSTUVWXYZ True