This Python program includes two scripts, 📜 encrypt.py
and 📜 decrypt.py
, designed for encrypting and decrypting text files using the Fernet encryption scheme from the cryptography
library.
The encrypt.py
script follows these steps:
- Gets the current directory.
- Identifies all text files (files with a '.txt' extension) in the directory.
- Generates a Fernet key.
- Writes the key to a file named
key.key
. - Encrypts the content of each text file using the generated key.
The decrypt.py
script follows these steps:
- Gets the current directory.
- Identifies all encrypted text files in the directory (files with a '.txt' extension).
- Reads the Fernet key from the
key.key
file. - Decrypts the content of each encrypted text file using the stored key.
- Python
cryptography
library
Install the required library using:
pip install cryptography
Feel free to contribute to the project by opening issues or submitting pull requests. Follow the guidelines outlined in CONTRIBUTING.md.
Run the encryption script using a Python interpreter:
python encrypt.py
Run the decryption script using a Python interpreter:
python decrypt.py
The encryption key is generated and stored in a file named key.key
during the encryption process. This key file is crucial for decryption. Ensure its security and do not share it with encrypted files.
- Keep the encryption key (
key.key
) secure. - Do not share the key or store it with the encrypted files.
- Losing the key will result in permanent data loss as decryption will not be possible.
Caution: Use this encryption method responsibly, and always keep a secure backup of your key.
This project is licensed under the MIT License - see the LICENSE.md file for details.
Disclaimer: This program is for educational purposes and should be used responsibly. The developers are not responsible for any misuse or data loss resulting from the use of this software.