Encrypts and decrypts image files using AES encryption in GCM mode.
Project description
AEIF (AES Encrypted Image File) Library
The AEIF (AES Encrypted Image File) library is a Python library that provides functionality for encrypting and decrypting image files using the AES encryption algorithm.
Installation
You can install the AEIF library using pip:
pip install aeif-lib
Usage
Generating a key
To generate a key, you can use the genkey function:
from aeif_lib import genkey
# Generate a random key with the specified size
# (only 16, 24, and 32 bytes is supported) and save it to a file
key_path, key = genkey("path/to/save/key")
Encrypting an image
To encrypt an image, you can use the encrypt function:
from aeif_lib import AEIFManager, genkey, verify_hash
key_path, _ = genkey("path/to/save/key", 32)
# Create an AEIFManager object
# (key_path is optional but will be required for encryption/decryption if not set)
aeif = AEIFManager(key_path)
# Encrypt the image (key or key_path is optional if the key is already set)
aeif.encrypt("./img.png", "./img_e.aeif")
Decrypting an image
To decrypt an image, you can use the decrypt function:
from aeif_lib import AEIFManager
key_path = "path/to/the/key"
# Create an AEIFManager object
# (key_path is optional but will be required for encryption/decryption if not set)
aeif = AEIFManager(key_path)
# Decrypt the image (key or key_path is optional if the key is already set)
aeif.decrypt("./img_e.aeif", "./img_d.png")
# Verify the hash of the original image and the decrypted image
verify = verify_hash(("./img.png", "./img_d.png"))
print("Hashes match!" if verify else "Hashes do not match!")
Project details
Release history Release notifications | RSS feed
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 aeif-lib-0.0.3.tar.gz.
File metadata
- Download URL: aeif-lib-0.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccaeb67e8471399e40bad452908725105e6d1a9cc5bda479a8b2f74949f4cd30
|
|
| MD5 |
216eadb021cea0ed6eda24f04034fa36
|
|
| BLAKE2b-256 |
b037ff9911de9543b0b4a8642d96abc7227f0859973ea82c9ab1579669e66db2
|
File details
Details for the file aeif_lib-0.0.3-py3-none-any.whl.
File metadata
- Download URL: aeif_lib-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed1d918a58cd2b745b63fd6e6e24656c0f4758655fa52440e27e163553e16f6c
|
|
| MD5 |
81fa383e33f1f12bb3cebd53aea00d53
|
|
| BLAKE2b-256 |
c427b5bc4f6732e593dec1b900ab5238e793820294555073ae1248e35ba04600
|