Skip to main content

Encrypt an arbitrary list of messages into one ciphertext and decrypt back (AEAD)

Project description

multimsg-aead

Rust library (exposed to Python via pyo3 + maturin) that encrypts an arbitrary list of messages into a single authenticated ciphertext and decrypts it back.

  • AEAD ciphers: AES-256-GCM (default) or ChaCha20-Poly1305
  • Self-describing envelope: [version | alg | noncelen | nonce | ciphertext+tag]
  • Optional AAD binds context and header for integrity
  • Enforces >= 3 messages
  • Cross-platform: pure Rust crypto crates (Linux/Windows)

Build (dev install into current venv)

pip install maturin
maturin develop --release

Use from Python

from multimsg_aead import generate_key, encrypt_texts, decrypt_texts

key = generate_key()  # 32 random bytes
msgs = ["hello", "from", "rust+python"]
aad = b"example-context"           # optional

ct = encrypt_texts(msgs, key, algorithm="aes256gcm", aad=aad)
print("ciphertext len:", len(ct))

roundtrip = decrypt_texts(ct, key, aad=aad)
print(roundtrip)                    # ['hello', 'from', 'rust+python']

Notes

  • Do not reuse a (key, nonce) pair. Nonce is random & included in the envelope.
  • If decryption fails, you likely used the wrong key/AAD or the data was corrupted.
  • Import name is multimsg_aead (underscore); pip package is multimsg-aead (hyphen).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

irene_crypto-0.1.1-cp38-abi3-win_amd64.whl (164.7 kB view details)

Uploaded CPython 3.8+Windows x86-64

irene_crypto-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (263.4 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

File details

Details for the file irene_crypto-0.1.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: irene_crypto-0.1.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 164.7 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for irene_crypto-0.1.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ff4a11cfeb678a4ae888a05fcf9b9c2eb943d4ee00cbf3a6008fffacc75dd556
MD5 800049a824850b2d69e72d2a28c96b68
BLAKE2b-256 11b5f56f078143c0cad1c7e6fa1450c353177c070113ec9cff77c487b43a20a4

See more details on using hashes here.

File details

Details for the file irene_crypto-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for irene_crypto-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e98fbeb4afd02208feee8d39dd99d3ebc725acd9fd3d5a4713f7aa9eff32dd42
MD5 36d5c673987c50ddfce565e93d995662
BLAKE2b-256 7d813d8ccf97b714027879a2fa3573a5b732613d72ab09b8e9f26de1f5eec49e

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