This is a Python module for file encryption and decryption using a password-based approach. It leverages the cryptography library to provide a simple and secure way to protect your files.
To use this module, you need to install the required dependencies. You can do this using pip and the provided requirements.txt file:
-
Import the
FileEncryptorclass from the module. -
Create an instance of
FileEncryptor. -
Set the password for encryption and decryption using the
set_passwordmethod. -
Use the
encrypt_filemethod to encrypt a file. The original file will be deleted after encryption. -
Use the
decrypt_filemethod to decrypt a file. The.encfile will be deleted after decryption.
Here's an example of how to use the module:
from file_encryptor import FileEncryptor
encryptor = FileEncryptor()
# To set a password
password = "my_secure_password"
encryptor.set_password(password)
# To encrypt a file
encryptor.encrypt_file('file_encryption_decryption/example.txt')
# To decrypt the file
encryptor.decrypt_file('file_encryption_decryption/example.txt.enc')