Skip to main content

Fast ML-KEM implementation with C extensions

Project description

Keeper ML-KEM

Production-ready post-quantum cryptography library implementing ML-KEM (FIPS 203) for Keeper Commander applications.

Overview

This package provides a lightweight, optimized implementation of the Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) as standardized in FIPS 203. It features native C extensions for performance-critical operations while maintaining a simple, intuitive API.

Installation

pip install keeper-mlkem

Usage

Basic Example

from mlkem import ML_KEM, MLKEM_768_PARAMETERS

# Initialize ML-KEM-768
ml_kem = ML_KEM(MLKEM_768_PARAMETERS)

# Generate key pair
encapsulation_key, decapsulation_key = ml_kem.key_gen()

# Encapsulate (create shared secret)
shared_secret, ciphertext = ml_kem.encaps(encapsulation_key)

# Decapsulate (recover shared secret)
recovered_secret = ml_kem.decaps(decapsulation_key, ciphertext)

assert shared_secret == recovered_secret

Security Parameters

Three security levels are available, aligned with NIST security categories:

from mlkem import MLKEM_512_PARAMETERS, MLKEM_768_PARAMETERS, MLKEM_1024_PARAMETERS

ML_KEM(MLKEM_512_PARAMETERS)   # NIST Level 1 (128-bit security)
ML_KEM(MLKEM_768_PARAMETERS)   # NIST Level 3 (192-bit security) - Recommended
ML_KEM(MLKEM_1024_PARAMETERS)  # NIST Level 5 (256-bit security)

Technical Specifications

  • Standard: FIPS 203 (Module-Lattice-Based Key-Encapsulation Mechanism)
  • Language: Python 3.11+
  • Performance: Optimized C extensions for cryptographic operations
  • Validation: Tested against official NIST test vectors

System Requirements

  • Python 3.11 or higher
  • C compiler (for installation from source)
    • Linux: GCC (typically pre-installed)
    • macOS: Clang via Xcode Command Line Tools (xcode-select --install)
    • Windows: Microsoft Visual C++ Build Tools

Pre-built wheels are available for major platforms (Linux, macOS, Windows) and common architectures.

About ML-KEM

ML-KEM is a post-quantum cryptographic algorithm designed to resist attacks from both classical and quantum computers. It provides a secure method for two parties to establish a shared secret over an insecure channel:

  1. Key Generation: Generate a public/private key pair
  2. Encapsulation: Use the public key to generate a shared secret and ciphertext
  3. Decapsulation: Use the private key to recover the shared secret from the ciphertext

The resulting shared secret can be used with symmetric encryption algorithms (e.g., AES) or key derivation functions for secure communications.

License

MIT License - Copyright (c) 2025 Keeper Security Inc.

Security Notice

This library implements ML-KEM (FIPS 203) and has been validated against official NIST test vectors. While it is suitable for production use, users should follow best practices for cryptographic implementations:

  • Keep the library updated to receive security patches
  • Use appropriate key sizes for your security requirements (ML-KEM-768 is recommended for most applications)
  • Properly handle and store private keys

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

keeper_mlkem-1.0.2.tar.gz (11.6 kB view details)

Uploaded Source

Built Distributions

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

keeper_mlkem-1.0.2-cp313-cp313-win_amd64.whl (24.3 kB view details)

Uploaded CPython 3.13Windows x86-64

keeper_mlkem-1.0.2-cp313-cp313-win32.whl (21.2 kB view details)

Uploaded CPython 3.13Windows x86

keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (36.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

keeper_mlkem-1.0.2-cp313-cp313-macosx_11_0_arm64.whl (33.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

keeper_mlkem-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

keeper_mlkem-1.0.2-cp312-cp312-win_amd64.whl (24.3 kB view details)

Uploaded CPython 3.12Windows x86-64

keeper_mlkem-1.0.2-cp312-cp312-win32.whl (21.2 kB view details)

Uploaded CPython 3.12Windows x86

keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (36.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

keeper_mlkem-1.0.2-cp312-cp312-macosx_11_0_arm64.whl (33.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

keeper_mlkem-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

keeper_mlkem-1.0.2-cp311-cp311-win_amd64.whl (24.3 kB view details)

Uploaded CPython 3.11Windows x86-64

keeper_mlkem-1.0.2-cp311-cp311-win32.whl (21.2 kB view details)

Uploaded CPython 3.11Windows x86

keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (36.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

keeper_mlkem-1.0.2-cp311-cp311-macosx_11_0_arm64.whl (33.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

keeper_mlkem-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl (34.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file keeper_mlkem-1.0.2.tar.gz.

File metadata

  • Download URL: keeper_mlkem-1.0.2.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for keeper_mlkem-1.0.2.tar.gz
Algorithm Hash digest
SHA256 52f472df2c7ebcad64770cdfbc1321bb4014009ec32f731a3faa2afd4870d837
MD5 5a863619dc6784b93ce518b90397e6f6
BLAKE2b-256 606e18aff45dca0f76cd767ec75879235ea7f465d480adde5cce591b4ff24eda

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4a38f5c96eef8f23a5181bd0a09af50512cbbbab1303101faa6520f73e60dbe5
MD5 2f4fbf090b9c6259cec6783a4056615d
BLAKE2b-256 e299b1c8a191313ed3e1721ee53dc58d9ffbf6238b35ba0dfb743702e7eb7e7e

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-win32.whl.

File metadata

  • Download URL: keeper_mlkem-1.0.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a6284163ff3c8cf033f79b990af5705ec4cb4b46a27dcb2f4785fa9fb184a8e9
MD5 799c4b9035110b023badf6522cd8418e
BLAKE2b-256 192da2ebc82ad282a6f0da9d369dda8152ec7a261a071029742758ee84d8ef63

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b07bdff79d6b9f2c188f4a8d083a8f26e34104611578650c998e361f17733a6a
MD5 439e5bf2d77a5da006a2532d37cfa098
BLAKE2b-256 0bfa11ce9be94e7aff741da7032a0aac11b101439513c2d12f7ae3a590dda442

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8f5ab89f6e9c444375a3c97cabcfc8854ffad5532ffbef833363a88ec39dbaf0
MD5 df11dd4f717d6d732c94428dc1f3551a
BLAKE2b-256 342a69b89cad42a9e6c47a72462274c6cce916ace43623a796a49fd073f57b72

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 551ef89a3fd1fd5c2635667309b08638288e6b0e1229c43b84c078e540f59447
MD5 a07a5225293e2dfba82a67edff14a1eb
BLAKE2b-256 51c701c85e56b78f6aa7285754e530b46919d1267adb8ec578b0dfe01ab438a4

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c1c13f7d171405cc7bd6794a2df76dfb5345a9d738899b5ff854c5dc78011ad9
MD5 870fad503a4a64f59062d78c40a8a4b6
BLAKE2b-256 f74a2c8b35fb6ead08798fe8134f028e094be33b1c0916bbc88a382c7c0ecddb

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0646fa23e7a22af589e6bd3d6726566080ca49330d8d112b9b1457fe7c2a435b
MD5 748b4a41e93dda9f83dede64f0d4e8a3
BLAKE2b-256 aaffdb08e8a09a1255469c936d02e5879e6efcbd5f005bfdff6810d20a8bb115

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-win32.whl.

File metadata

  • Download URL: keeper_mlkem-1.0.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 cd07497e0ebd2881e117994baca83302e9ba4be4c328ee2aa1444687469aff27
MD5 360c416d7fd442bc5cf8983e658dde92
BLAKE2b-256 c98e25b54c5b8e4df265f75c3bfda9f81f44fbb24d7be364a7a4f4a8cccb10fb

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f2dd842469787a7adafa7767598a2bd7db0205d5f52d063a7471bf08dddb955a
MD5 32ed80d5ea4291068de51129d06ff969
BLAKE2b-256 c6f667cd712c362a5e68a15822c5fb6e9698e48660c5f881e732ed03bfe534d4

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b8a39c1b44016707cb47481cefd1dcea54e278b33f5505590f1a0474e1ac8b80
MD5 c03526f564602ccad92bafc50e1cba47
BLAKE2b-256 2d8447276e66b32d9c60d393b3971219554a1543300d667f84b3eca51221e878

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 837d5efa1d71652c563f07aedee117be4f1a12327cd5364d27d64f97162f02f3
MD5 f60c64208a7c2c79ca15fd8f95b32be9
BLAKE2b-256 b48e9cb4862f63a1edd23b30b4bcb6c646facff0b5c8ed98405e13c34a8977c6

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5bf9cff62a59ee993942e66d37421adce1a9011af761767bff9fc6645ce55f55
MD5 669ed06875b0b0837b6145b28a18334f
BLAKE2b-256 383ea454bf2a9ce0c61b4e7f8d8a962b4dc2f873803926ccbb3cb067e907fce9

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 aa691cd96054204ee7fbc5e90447c3c8c331708de5a118087a2b2246a9bcc6a8
MD5 4a9e43839ff2876ff0c4b9a02deb9b15
BLAKE2b-256 ba391a2cd15b1902efc5e4fbea5124a3452a718ee703f7ee1d8ee07eb4648192

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-win32.whl.

File metadata

  • Download URL: keeper_mlkem-1.0.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 943717489df2b788c96b5d77bb216db2db73206ad716a50f16339f3276f517f1
MD5 232b07059ce07de8486fe331f3acd993
BLAKE2b-256 1d322cbd232a1f4474faee55eb401dbcc4526150b06d342ce1f6afe9025b3d80

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da2ea3bd24ce18e72c112dab47170ddb770afe91f2ae0eec68aed67774d19e12
MD5 f7fd065eb18124ff2ef15312eb7bdf44
BLAKE2b-256 50d66b2296687a0d09c899e73b8878635e7a5d43df236159a9cc998daf65cb5a

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 49aca667cddb37d8c1e12fbffc6e7d91ae95a28f8b73de2a35ad762240563ff7
MD5 589746f3417eea636befef2898423aa0
BLAKE2b-256 e03712082e1dc40bae742b1276b47eb750cfbafd8c755abcff3f1081d51bb9c6

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 005ef3bdd6527163012d07c608e3968f39c2267bc9c951e5755b15325a6c6c60
MD5 cb99ace13d435d60a825824ed06f6ff1
BLAKE2b-256 93d74555e33fe951264a4748746b74060f0b31b672c6557e4db03681a9d66d74

See more details on using hashes here.

File details

Details for the file keeper_mlkem-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for keeper_mlkem-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 61f9735928e41efa65482330344353b0f438b308d26569ae322cd7d544633486
MD5 d9a5f1a85af6c896385f2ae5e4555fd9
BLAKE2b-256 337e208b3b1a29e9b795cc433b0c741ac2489e4024f9cd86464d55eac0f8e7ea

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