A simple, powerful command-line tool to encrypt and decrypt messages using the classic Vigenère cipher. It showcases a historical polyalphabetic cipher in under 100 lines of clean, PEP 8–compliant Python code.
🔐 Encrypt any plaintext message with a secret keyword. 🔓 Decrypt ciphertext back to its original form using the same keyword. 🔄 Handles messages of any length by looping the keyword. ✍️ Preserves original character case and ignores non-alphabetic characters (spaces, punctuation, numbers).
Written in pure Python — no external libraries needed 🐍. Under 100 lines of readable, well-commented code 💯. Demonstrates: String manipulation and dictionary lookups. The power of modulo arithmetic for cryptographic wrapping. Clean function design with clear parameters. Following PEP 8 style guidelines.
Save the code as vigenere.py. Open a terminal or command prompt in the same directory. Run the script: Bash python vigenere.py The script will run a pre-defined example to demonstrate its functionality. You can easily change the message and keyword variables inside the file to test your own text! 🎯
Running the script produces the following output:
Original Message: Hello, World! This is a secret message. Keyword: PYTHON Encrypted Message: Gsmop, Fyrvj! Hmie si e wsqbch iawwegs. Decrypted Message: Hello, World! This is a secret message.
Made with ❤️ by a Python enthusiast. A perfect mini-project for anyone interested in cryptography, algorithms, or practical applications of core Python concepts.