This is a Python program that uses the cryptography
library's Fernet
method for encryption and decryption. It provides a simple command-line interface to choose between encrypting and decrypting a message.
- Encrypt any message using the Fernet encryption method.
- Decrypt any previously encrypted message using the same method.
- Automatically generates and uses a secret key for encryption and decryption.
-
Clone the repository:
git clone https://github.com/yourusername/encryption-decryption.git cd encryption-decryption
-
Install the required dependencies:
pip install cryptography
-
Run the program:
python main.py
-
Choose between encryption (
E
) and decryption (D
):- For encryption, enter the message you want to encrypt.
- For decryption, enter the encrypted message.
- The program generates a
secret.key
file if it doesn't exist. - This key is used for both encryption and decryption.
- Keep the
secret.key
file safe. Losing this file will make it impossible to decrypt any messages encrypted with it.
Choose (E)ncrypt or (D)ecrypt: E
Enter the message to encrypt: Hello, world!
Encrypted message: gAAAAABeJc2V-MvhF7L3qfjzIHHGJ9tF5MEP3Gj2Pi8Y5kbU6iE4z6MSv1JazbTtXRXFwG1Y1NRpkRznlx0Kigc=
Choose (E)ncrypt or (D)ecrypt: D
Enter the message to decrypt: gAAAAABeJc2V-MvhF7L3qfjzIHHGJ9tF5MEP3Gj2Pi8Y5kbU6iE4z6MSv1JazbTtXRXFwG1Y1NRpkRznlx0Kigc=
Decrypted message: Hello, world!
encryption-decryption/
│
├── main.py # The main script to run the program
├── secret.key # The secret key file (auto-generated)
└── README.md # This README file
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Prince