Skip to main content

Python3 password manager library.

Project description

Einar

PyPI - Downloads PyPI - License GitHub Tag

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

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

einar-2.0.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

einar-2.0.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file einar-2.0.0.tar.gz.

File metadata

  • Download URL: einar-2.0.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for einar-2.0.0.tar.gz
Algorithm Hash digest
SHA256 74c09bb62792d92ea51b3f20cdff298214f202589a159707b2c5da7cfd207bc1
MD5 f5db6480f7cecb2c79e65c90956719e2
BLAKE2b-256 01cc28b95c27ce0afa149acfe1ae4d7d8f3fc784b9f3711c9217fd3cde2a658f

See more details on using hashes here.

File details

Details for the file einar-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: einar-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for einar-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 580042dd266116f6b30a79b1b98a0d7c86da874c388c36a622df8d68361bc849
MD5 3a43dbb1bc702a2596fa8bc6a2906c92
BLAKE2b-256 83facbc5f1c23718f4099a918b09ea06e1582802a921830b0831a555a7abd125

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