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.0-cp38-abi3-win_amd64.whl (164.7 kB view details)

Uploaded CPython 3.8+Windows x86-64

Irene_crypto-0.1.0-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.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: Irene_crypto-0.1.0-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.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cd0a723649667be30ed8406429ab8fbb008e05b8b8918b36f91513b86be78b95
MD5 092f8f1d250bbf803b1f882b7a581bfe
BLAKE2b-256 3cc1b29bee58eb8031b9bfd947298c90990d23e4d045dd469d23416d74403fc9

See more details on using hashes here.

File details

Details for the file Irene_crypto-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for Irene_crypto-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 facfc46cd6f7ab930677670859bec2d4a7afe2f0b254c54a14c91e31f6696b83
MD5 9881518df148f977a2dedcc35b5cb67f
BLAKE2b-256 8bd27069d0e22f0a1ded883e5d178484e9e5088e19d02ee965e225a411e47e37

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