Skip to content

πŸ§©πŸ”’ - Vigenere cipher: encode/decode using passcodes

License

Notifications You must be signed in to change notification settings

d4v1-sudo/vigenere-cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§©πŸ”’ - Vigenere Cipher

This Python script implements the Vigenere cipher for encrypting and decrypting text based on a provided keyword.

Usage

  1. Clone the Repository:

    https://github.com/d4v1-sudo/vigenere-cipher.git
    cd vigenere-cipher
  2. Run the Script:

    python3 vigenere_cipher.py
  3. Follow the Prompts:

    • Enter the text to be processed.
    • Enter the keyword for encryption or decryption.
    • Choose to encrypt or decrypt by typing 'e' or 'd' accordingly.

Script Description

The Python script consists of two functions:

generateKey(string, key)

This function generates a key of the same length as the input string by repeating the provided keyword. If the lengths are already equal, the key is returned as is.

vigenere(string, key, mode)

This function performs the Vigenere cipher operation on the input string using the provided key and specified mode ('e' for encryption or 'd' for decryption).

  • Encryption (mode == "e"): Encrypts the input text using the Vigenere cipher.
  • Decryption (mode == "d"): Decrypts the input text using the Vigenere cipher.

Example

Text to process: HelloWorld
Keyword: KEY
Encrypt or decrypt? (Type 'e' or 'd'): e
Ciphertext: RiJvsPvyG

Note

  • Make sure to only enter alphabetic characters in the input text.
  • The keyword should consist of alphabetic characters only.

Feel free to use and modify the script for your cryptographic needs. If you encounter any issues or have suggestions for improvements, please let us know.

Releases

No releases published

Packages

No packages published

Languages