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.2.tar.gz (214.3 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.2-py3-none-any.whl (215.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smaj_kyber-0.1.2.tar.gz
  • Upload date:
  • Size: 214.3 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.2.tar.gz
Algorithm Hash digest
SHA256 038ba69e198b8b8048681ebf1c7ea4640a254e1049476c4ab4c2a5a3407ecd05
MD5 41220436d9c5f750226a9f086b5af215
BLAKE2b-256 e09c6911ea29ecd6e99f08e2627185fb038958d2f7a4bf68ad6d5fff1ee2e136

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smaj_kyber-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 215.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab380f60f342e7920e2674a8a097b48d147d58579b50d9b95be257af2e901910
MD5 157d89b435719ce68914aa56c240db99
BLAKE2b-256 5dbcab765ed8f750228c18301262ba0285ad316dc833a7a18361c16e4d2badb5

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