Skip to main content

Kyber KEM wrapper using ctypes and dylib

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

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.1.tar.gz (3.4 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.1-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smaj_kyber-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 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.1.tar.gz
Algorithm Hash digest
SHA256 5d5ac0d73ba928f54dcccdaf865368e7a02d33955e60e34bc6509bf87f33861c
MD5 ff893cfcd2cc27e19dd7d087a4768b2b
BLAKE2b-256 2cd6097af9e40eb888c97a7fc5d7d8f0ec98dd35c9ae89f2f5f963f7963acaf2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smaj_kyber-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 51.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75cf50561deb3fcfe5d972bb28916e3799c0303fad4056654b084a86a3249127
MD5 0af7f0674d1a9d89f59a202cd95ddbd5
BLAKE2b-256 e10ef73d7f1f9cfcf9da57c8232a6feb4c702bc4424ace8bcee9bdc19b5acdba

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