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 | Provenance | Actions |
|---|---|---|---|---|
| einar-2.0.0.tar.gz | 15.5 kB | Without provenance | Details for einar-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| einar-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for einar-2.0.0-py3-none-any.whl |
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
|
Security for einar 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.