Skip to content

A Python toolkit for encrypting, decrypting, and cracking Vigenère ciphers using various cryptanalysis techniques. This project pays tribute to the historical Vigenère cipher while showcasing modern methods for breaking it, including brute-force attacks, dictionary attacks, and crib-based attacks.

License

Notifications You must be signed in to change notification settings

jameshu88/vig3n3r3

Repository files navigation

Vig3n3r3 - A Python Vigenère Cipher Cracking Tool

██╗   ██╗██╗ ██████╗ ███████╗███╗   ██╗███████╗██████╗ ███████╗    ██████╗ ██╗   ██╗    ██╗ ██████╗██╗  ██╗██████╗ ██╗   ██╗███████╗       ██╗ 
██║   ██║██║██╔════╝ ██╔════╝████╗  ██║██╔════╝██╔══██╗██╔════╝    ██╔══██╗╚██╗ ██╔╝    ██║██╔════╝██║  ██║██╔══██╗██║   ██║██╔════╝    ██╗╚██╗
██║   ██║██║██║  ███╗█████╗  ██╔██╗ ██║█████╗  ██████╔╝█████╗      ██████╔╝ ╚████╔╝     ██║██║     ███████║██████╔╝██║   ██║███████╗    ╚═╝ ██║
╚██╗ ██╔╝██║██║   ██║██╔══╝  ██║╚██╗██║██╔══╝  ██╔══██╗██╔══╝      ██╔══██╗  ╚██╔╝      ██║██║     ╚════██║██╔══██╗██║   ██║╚════██║    ▄█╗ ██║
 ╚████╔╝ ██║╚██████╔╝███████╗██║ ╚████║███████╗██║  ██║███████╗    ██████╔╝   ██║       ██║╚██████╗     ██║██║  ██║╚██████╔╝███████║    ▀═╝██╔╝
  ╚═══╝  ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝╚══════╝    ╚═════╝    ╚═╝       ╚═╝ ╚═════╝     ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝       ╚═╝

About Vig3n3r3

Vig3n3r3 is a Python-based cryptography tool designed to encrypt, decrypt, and crack Vigenère cipher-encrypted messages using various cryptanalysis methods like brute force, dictionary attacks, and crib attacks. This project is built as a tribute to one of history's most famous ciphers and demonstrates how modern techniques can unravel what was once thought to be unbreakable.

Table of Contents

Features

  • Encrypt and Decrypt messages using the Vigenère cipher.
  • Brute-force Attack: Crack a cipher by trying all possible keys.
  • Dictionary Attack: Use a predefined wordlist to guess the key.
  • Crib Attack: Use known plaintext segments to deduce the key.

Setup

To get started with Vig3n3r3, follow these steps:

1. Clone the repository

git clone https://github.com/your-username/vig3n3r3.git
cd vig3n3r3

2. Install dependencies

The project does not require any external Python packages. Just ensure you are using Python 3.x by checking:

python --version

3. Run the script

To run the script, use the following command:

python vig3n3r3.py "CIPHERTEXT" --method METHOD_NUMBER --keylength LENGTH --crib "KNOWN_PLAINTEXT"
  • CIPHERTEXT: The encrypted message.
  • METHOD_NUMBER: Choose from 1 (dictionary), 2 (brute force), 3 (crib attack), etc.
  • LENGTH: The length of the key (required for methods 1 and 2).
  • KNOWN_PLAINTEXT: The known part of the plaintext (required for method 3).

Usage

Example 1: Brute-force attack

python vig3n3r3.py "KXRKGIKXBKAL" --method 2 --keylength 3

This will attempt to brute force the key of length 3 and decrypt the message.

Example 2: Dictionary attack

python vig3n3r3.py "KXRKGIKXBKAL" --method 1 --keylength 3

This will search for a valid key of length 3 using the words from words.txt.

Example 3: Crib attack

python vig3n3r3.py "KXRKGIKXBKAL" --method 3 --crib "ATTACK"

This will attempt to find the key by using "ATTACK" as known plaintext.

Citing Data Sources

  • The wordlist for the dictionary attack was sourced from the enable1.txt wordlist, a popular open-source wordlist.
  • The monograms, bigrams, trigrams, and quadgrams data used for frequency analysis were obtained from Peter Norvig's Ngram Data.

Contributing

Welcoming contributions! Please feel free to submit a pull request or open an issue if you'd like to improve or fix something.

Instructions for contributing:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Link to Medium Article

For a detailed breakdown of the history behind the Vigenère cipher, modern cryptography techniques, and the story of Vig3n3r3, read my article on Medium: The Vigenère Cipher: From Unbreakable Enigma to Cryptographic Relic.

███████╗██╗   ██╗ ██████╗ ██████╗██████╗ ███████╗███████╗
██╔════╝██║   ██║██╔════╝██╔════╝╚════██╗██╔════╝██╔════╝
███████╗██║   ██║██║     ██║      █████╔╝███████╗███████╗
╚════██║██║   ██║██║     ██║      ╚═══██╗╚════██║╚════██║
███████║╚██████╔╝╚██████╗╚██████╗██████╔╝███████║███████║

About

A Python toolkit for encrypting, decrypting, and cracking Vigenère ciphers using various cryptanalysis techniques. This project pays tribute to the historical Vigenère cipher while showcasing modern methods for breaking it, including brute-force attacks, dictionary attacks, and crib-based attacks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages