Skip to content

Python implementation of the Vigenère cipher with encryption, decryption, and key-based text analysis.

Notifications You must be signed in to change notification settings

AFalkowski1/vigenere-cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Vigenère Cipher

This project is an implementation of the Vigenère cipher algorithms in Python. The program enables text encryption and decryption using a key, as well as cryptanalysis, which allows for breaking the encrypted message without knowing the key, based on letter frequency analysis.


Key Features

  • Encryption: Encrypts text from the plain.txt file using the key from the key.txt file and saves the result to crypto.txt.
  • Decryption: Decrypts text from the crypto.txt file using the key from key.txt and saves the result to decrypt.txt.
  • Cryptanalysis: Attempts to find the key and decrypt the text from the crypto.txt file without the key. Breaking the cipher is based on the index of coincidence method to find the key length and letter frequency analysis. The decrypted text is saved in decrypt.txt, and the found key in key-found.txt.
  • Text Preparation: Prepares the plaintext by removing non-alphabetic characters and converting the text to lowercase, saving the result in plain.txt.

Command Line Usage

The program is run with one of the following arguments:

  • -p: Prepares the plaintext.
  • -e: Encrypts.
  • -d: Decrypts.
  • -k: Cryptanalysis.

Usage examples: python vigenere-cipher.py -e python vigenere-cipher.py -k


Files

  • orig.txt: File with the original plaintext (used with the -p option).
  • plain.txt: File with the prepared plaintext.
  • key.txt: File with the key for encryption/decryption.
  • crypto.txt: File with the encrypted text.
  • decrypt.txt: File with the decrypted text.
  • key-found.txt: File with the key found by cryptanalysis.

Author: A. Falkowski | Project created as a programming exercise.

About

Python implementation of the Vigenère cipher with encryption, decryption, and key-based text analysis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages