A module for file encryption and decryption
Project description
pyfilecrypto Documentation
Overview
The pyfilecrypto module provides functionality for file encryption, decryption, and zip compression with password protection in Python. It leverages cryptography.fernet for file encryption and pyzipper for handling zip files with AES encryption.
Import
from pyfilecrypto.crypto import *
Classes
ACrypto
Methods:
- genKey(filename): Generates a new encryption key and saves it to the specified file.
ACrypto.genKey(filename)
- loadKey(filename): Loads an encryption key from the specified file.
ACrypto.loadKey(filename)
- encryptFile(original_filename, save_as, keyfile): Encrypts a file using the specified encryption key file and saves the encrypted data to another file.
ACrypto.encryptFile(original_filename, save_as, keyfile)
*decryptFile(filename, save_as, keyfile): Decrypts an encrypted file using the specified encryption key file and saves the decrypted data to another file.
ACrypto.decryptFile(filename, save_as, keyfile)
BCrypto
Methods:
- Encrypt(filename): Encrypts a file with multiple encryption keys ("alpha", "bravo", "charlie").
BCrypto.Encrypt(filename)
- Decrypt(filename): Decrypts a file that was encrypted with multiple keys ("charlie", "bravo", "alpha").
BCrypto.Decrypt(filename)
- crypt(filename, method): Encrypts or decrypts a file based on the specified method ("encrypt" or "decrypt").
BCrypto.crypt(filename, method)
Crypto
Methods:
- crypt(filename, method, password): Encrypts or decrypts a file with password-protected zip archive support.
Crypto.crypt(filename, method, password)
Usage
Method: 1
Generate Encryption Key and Encrypt File
from pyfilecrypto.crypto import ACrypto
ACrypto.encryptFile("test.txt", "test.enc", "my_secret.key")
Use key and Decrypt File
from pyfilecrypto.crypto import ACrypto
ACrypto.decryptFile("test.enc", "test.txt", "my_secret.key")
Method: 2
Generate Encryption Key and Encrypt File
from pyfilecrypto.crypto import BCrypto
BCrypto.Encrypt(filename = "test.txt")
Use keys and Decrypt file
from pyfilecrypto.crypto import BCrypto
BCrypto.Decrypt(filename = "test.txt")
Method: 3
Generate Encryption key and Encrypt File
from pyfilecrypto.crypto import BCrypto
BCrypto.crypt(filename = "test.txt", method = "encrypt")
Decrypt file using keys
from pyfilecrypto.crypto import BCrypto
BCrypto.crypt(filename = "test.txt", method = "decrypt")
Method: 4
Encrypt and Decrypt file with keys
from pyfilecrypto.crypto import Crypto
Crypto.crypt(filename = "test.txt", method = "encrypt", password = "password")
Crypto.crypt(filename = "test.txt", method = "decrypt", password = "password")
Dependencies
cryptographypyzipper
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfilecrypto-1.0.3.tar.gz.
File metadata
- Download URL: pyfilecrypto-1.0.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19b511660c70a48c48ec7ee05e12990fe38b181c7eede10f0abe095dc3412d2e
|
|
| MD5 |
ccd58cfb72d70b1d8c3ed8279efd2453
|
|
| BLAKE2b-256 |
7e454b544123e5195737e312a4e99e5ea8c5a785829df31a194d50b1ce913963
|
File details
Details for the file pyfilecrypto-1.0.3-py3-none-any.whl.
File metadata
- Download URL: pyfilecrypto-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62c89199bf36df06b77ac059a8acbf99ea2216368dcd90745a64b13bb29bc502
|
|
| MD5 |
0fc20b2b1cfec20807c4fd7fc444ce0c
|
|
| BLAKE2b-256 |
88c3312181eb56b3177fa2b29fb68c393088f25d0ea8cb185e0fef0a584e9e19
|