Skip to main content

AESHandler Script

Project description

AESHandler

AESHandler is a package that makes AES encryption and decryption easy.

Usage

import aeshandler

# The aeshandler module comes with a key_from_password() method in the AESHandler class.
# This method takes in a password, and runs a KDF function to create a key.
password = b'Password1234!'
crypto_tuple = aeshandler.AESHandler.key_from_password(password) # Default KDF is Bcrypt
'''
OUTPUT: (b'password1234!', b'he0bB3t4OZtAqjQlv77QOq1LHg6wSeD9rNskEiAV5LsMYGDXS8rBkEPLDIeQNshf', b'\x14\xe8\xf0\xcf\xf1\x16\x9d\xb6J\x9b\xc0\xfe\xed\xd7\xe9\xd0\x82\x10scip\xea|L&\x81\xacH\xa8O\x0e')
First element is the password, second element is the salt used with the KDF, third element is the derived key.
'''
crypto_key = crypto_tuple[-1] # b'\x14\xe8\xf0\xcf\xf1\x16\x9d\xb6J\x9b\xc0\xfe\xed\xd7\xe9\xd0\x82\x10scip\xea|L&\x81\xacH\xa8O\x0e'

'''
AESHandler supports all AES modes. Such as CBC, CFB, XTS, and so on.
Using CBC in this instance.
This may require the padding=True argument for PKCS7 padding.
use_encoding=True returns ciphertexts in base64 format.
'''
a = aeshandler.AESHandler(crypto_key, aeshandler.modes.CBC, padding=True, use_encoding=True)
ciphertext = a.encrypt('Hello!') # M4ENqqe0m0ys4a7e1fnWHtJD+DbGNY5ckfbJBShxkJ0=
print(ciphertext)
print(a.decrypt(ciphertext)) # b'Hello!'

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

aeshandler-0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

aeshandler-0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file aeshandler-0.1.tar.gz.

File metadata

  • Download URL: aeshandler-0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

File hashes

Hashes for aeshandler-0.1.tar.gz
Algorithm Hash digest
SHA256 0e047120f005566c4849009994bfaadd6732db14bb276af06398cc1f605203e1
MD5 0da6ee44159661334ce3cf46c6e7f518
BLAKE2b-256 ae8830d44db617b78884d83eb91c70c9b4778da1997d87bf19874704748e46de

See more details on using hashes here.

File details

Details for the file aeshandler-0.1-py3-none-any.whl.

File metadata

  • Download URL: aeshandler-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

File hashes

Hashes for aeshandler-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3a279c044553de2d4f56915ed4fb383ed8f7cb23e50a58123d294c5826f4ab3
MD5 9bf8267a9784d38116222eb64aa4c3b1
BLAKE2b-256 824e4b50a0f788d0fa976b7d1bdd833337d67290f76f37bf4d2cdb55daa9df91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page