No project description provided
Project description
Simple AES
Find more information about this library HERE
An easy way to use the aes CBC mode of pycryptodome. To use this library just type:
pip install pysimple_aes
Code examples
Automated key generation:
from pysimple_aes import *
key = keyGenerator()
IV = ivGenerator()
aes = simpleAES(key, IV)
text = "This is a test".encode()
ciphertext = aes.encrypt(text)
plaintext = aes.decrypt(ciphertext)
print("This is the ciphertext:", ciphertext)
print("This is the plaintext:", plaintext.decode())
Setup custom keys:
from pysimple_aes import *
key = "This is a key".encode()
iv = "This is an IV".encode()
salt = "This is a salt".encode()
# The hash option will hash the key with the sha256 algorithm
# and the IV with the md5 algorithm with the salt to
# prevent brute force attacks
aes = simpleAES(key, iv, hash=True, salt=salt)
text = "This is a text".encode()
ciphertext = aes.encrypt(text)
plaintext = aes.decrypt(ciphertext)
print("ciphertext:", ciphertext)
print("plaintext:", plaintext.decode())
Store the key to a file:
from pysimple_aes import *
key = keyGenerator()
IV = ivGenerator()
aes = simpleAES(key, IV)
path = "key.key"
aes.extractKey(path)
Store the key to an encrypted file:
from pysimple_aes import *
key = keyGenerator()
iv = ivGenerator()
aes = simpleAES(key, iv)
key2 = "abcde".encode()
iv2 = "12345".encode()
salt = "qwerty".encode()
aes2 = simpleAES(key, iv , hash=True, salt=salt)
path="encryptedKey.key"
#It will encrypt the file with the 'aes2' object.
aes.extractEncryptedKey(aes2, path)
Load the key from file:
from pysimple_aes import *
path = "key.key"
data = loadKeyFromFile(path)
key = data[0]
IV = data[1]
# When you load a key from file do not set the
# hash value to True or use the salt option,
# because in the file are stored the hashed values and not
# the original keywords.
aes = simpleAES(key, IV)
Load the key from encrypted file:
key = "abcde".encode()
iv = "12345".encode()
salt = "qwerty".encode()
aes = simpleAES(key, iv, hash=True, salt=salt)
path="encryptedKey.key"
data = loadKeyFromEncryptedFile(aes, path)
key = data[0]
iv = data[1]
aes = simpleAES(key, iv)
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 pycryptosimple_aes-1.0.tar.gz.
File metadata
- Download URL: pycryptosimple_aes-1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4a5468965e476b2d3e7cbb4de26cf045ce7cecedb7dc5d1f4225d1993b6ff0
|
|
| MD5 |
22b92a8d6b4691251ec5167358a11d6f
|
|
| BLAKE2b-256 |
e4136bbeea2e6a293b0d236de744460a4a1d170744ddc00913bf31f84ebd44b4
|
File details
Details for the file pycryptosimple_aes-1.0-py3-none-any.whl.
File metadata
- Download URL: pycryptosimple_aes-1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f043cc21b3d7ed97b230bbc1e5581e20621747de56889d3687a431c97391c3bf
|
|
| MD5 |
e715a56caf6ed6394cfe50add8ce6f1f
|
|
| BLAKE2b-256 |
489e95e04f20575c1fa5a8299326af14318fc34b531a272b0b8c344fd11d7cf5
|