Einar
Python3 library that implements AES-128, AES-192, AES-256 encryption in ECB and CBC modes.
Install
pip install einar
Quickstart
from einar import AES
key = b'' # The key can be any size; it will be padded or truncated to the required length.
# AES-256 CBC example
iv = b'1234567890abcdef' # Required for CBC mode, must be 16 bytes
cipher = AES(key, keyLen=256, mode="CBC", iv=iv)
message = b'Secret message to encrypt'
Encrypt
ciphertext = cipher.encrypt(message)
print(f"Ciphertext (hex): {ciphertext.hex()}")
Decrypt
original_text = cipher.decrypt(ciphertext)
print(f"Original text: {original_text.decode('utf-8')}")
Modes
ECB (Electronic Codebook)
cipher = AES(key, keyLen=128, mode="ECB")
ciphertext = cipher.encrypt(message)
original_text = cipher.decrypt(ciphertext)
CBC (Cipher Block Chaining)
iv = b'1234567890abcdef' # 16 bytes
cipher = AES(key, keyLen=256, mode="CBC", iv=iv)
ciphertext = cipher.encrypt(message)
original_text = cipher.decrypt(ciphertext)
CLI
Einar includes a command-line interface for encryption and decryption:
einar -e "Secret message" -kl 256 -m CBC
License
Distributed under GPL v2 or later.
Author
Juan
Metadata
Release files for einar 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| einar-2.0.0.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| einar-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / einar-2.0.0.tar.gz
| Download URL | einar-2.0.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74c09bb62792d92ea51b3f20cdff298214f202589a159707b2c5da7cfd207bc1
|
|
BLAKE2b-256 checksum How to use checksums |
01cc28b95c27ce0afa149acfe1ae4d7d8f3fc784b9f3711c9217fd3cde2a658f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Release files / einar-2.0.0-py3-none-any.whl
| Download URL | einar-2.0.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
580042dd266116f6b30a79b1b98a0d7c86da874c388c36a622df8d68361bc849
|
|
BLAKE2b-256 checksum How to use checksums |
83facbc5f1c23718f4099a918b09ea06e1582802a921830b0831a555a7abd125
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|