Skip to main content

Kyber KEM wrapper using ctypes and platform-specific dynamic libraries

Project description

smaj_kyber

smaj_kyber is a Python package that wraps the Kyber post-quantum Key Encapsulation Mechanism (KEM) using Python’s ctypes and a compiled C shared library.

✅ This implementation is a lightweight wrapper around the C reference implementation of Kyber submitted to NIST as part of the Post-Quantum Cryptography standardization process.

⚠️ This package is created strictly for research and educational purposes. It is not audited or recommended for production use.


Features

  • ✅ Bindings to the C reference implementation
  • ✅ Support for Kyber512, Kyber768, and Kyber1024
  • ✅ No need for C++ or pybind11 — pure ctypes usage
  • ✅ Easy to switch modes inside Python code
  • ✅ Cross platform Linux, Windows , macOS

Usage Example

from smaj_kyber import keygen, encapsulate, decapsulate, set_mode

# Set mode: "512", "768", or "1024"
set_mode("512")

# Bob generates a keypair
pk, sk = keygen()

# Alice uses pk to encapsulate a shared secret
ct, ss1 = encapsulate(pk)

# Bob uses his sk to decapsulate and derive the same shared secret
ss2 = decapsulate(ct, sk)

print("Shared secret 1:", ss1.hex())
print("Shared secret 2:", ss2.hex())
print("Match:", ss1 == ss2)

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

smaj_kyber-0.1.3.tar.gz (359.1 kB view details)

Uploaded Source

Built Distribution

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

smaj_kyber-0.1.3-py3-none-any.whl (363.3 kB view details)

Uploaded Python 3

File details

Details for the file smaj_kyber-0.1.3.tar.gz.

File metadata

  • Download URL: smaj_kyber-0.1.3.tar.gz
  • Upload date:
  • Size: 359.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for smaj_kyber-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2016f9d80cde7ca8d89e7d86c82c17359e843c59e2921daf01e6e2a34e070536
MD5 9a27db97cd7b2887a59b2029240567a3
BLAKE2b-256 d72db49bffe2ee293a67534183d4ee2d9b02843cd537866c7f42cd584189ebb7

See more details on using hashes here.

File details

Details for the file smaj_kyber-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: smaj_kyber-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 363.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for smaj_kyber-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b7966e2bdecce7b5863a3ec1d5e9c7575af3237695cbf357e0297220494d58
MD5 dc9a359a398df8216b343fd79e128d50
BLAKE2b-256 b995019834512080b8776ed827664a687208b434106d8a399bb0056137f8ebb4

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