Skip to main content

AES encryption library written entirely in pure python. No other system dependencies required.

Project description

What?

The original zero dependency python only AES implemntation. See

blitzkloud

tips ethercrypt.eth

Installation

pip3 install purePyAES

Example Usage

from purePyAES.py_aes import AesWrapper

def gen_random_key():
    with open("/dev/urandom", 'rb') as fb:
        fb = fb.read(32)
        return fb.hex().__str__()


if __name__ == "__main__":
    """
    Example usage. Super straightforward.
    First written for BlitzKloud. There was no pure python AES
    at that time.
    """
    # Generate a key. Must be either 8,16, or 32 characters
    print('[+] Generating a random AES key ...')
    key = gen_random_key()[:32]
    print('[+] AES key generated: {}'.format(key))
    aes = AesWrapper(key.encode())  # also should be bytes
    enc_input = input('type something >> ') # input some data to encrypt
    if not enc_input or enc_input.strip('\r\n') == '':
        print("[+] Or don't")
        enc_input = 'test this data'
        print('[+] We will use `test this data` then ...')
    print('[encrypted] (b64 wrapped) aes encrypted data `aes.encrypt`: ')
    enc_data = aes.encrypt(enc_input)
    print(enc_data)
    denc_data = aes.decrypt(enc_data)
    print('aes.decrypt: ')
    print('[decrypted] %s data aes.decrypt`')
    print(denc_data)




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

purepyaes-0.0.5.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

purepyaes-0.0.5-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file purepyaes-0.0.5.tar.gz.

File metadata

  • Download URL: purepyaes-0.0.5.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for purepyaes-0.0.5.tar.gz
Algorithm Hash digest
SHA256 34a1453426c2263f6d2af647343037e13dbc1bc5036a701dadf7fb0be64d70cc
MD5 78471af53b81177ff361ec202a49dda0
BLAKE2b-256 16d95d4de367557c01fb99dbba0683a45b423292e0f8e9a184128d5550350869

See more details on using hashes here.

File details

Details for the file purepyaes-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: purepyaes-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for purepyaes-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cd2db3295526725f1d71746838535ba1a0f525b92f0e7dd3489f6634bec8e913
MD5 72da0f29c2c7f647f2b6629ccbadcdb9
BLAKE2b-256 0b21ddf5b4d0e5918695880681e52f954d1717f3ae9e6f57f9b459e0842ab142

See more details on using hashes here.

Supported by

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