Skip to main content

modularot

Modular KEM-based 1-out-of-n Oblivious Transfer (semi-honest). The protocol never names a specific KEM: the only KEM-specific step, sampling an oblivious public key (a well-formed key nobody holds the secret for), is passed in as a callable.

The receiver sends one real public key for its choice and oblivious keys for the other branches. The sender encapsulates under every key and seals each message with ChaCha20-Poly1305. The receiver can only open the chosen one.

Samplers are included for ML-KEM / Kyber, FrodoKEM, NTRU-HPS / HRSS and sntrup761 (via liboqs), plus two research KEMs, NTRU_FO and GGH_FO, built with the Fujisaki-Okamoto transform.

Install

pip install modularot

Requires the liboqs C library, installed before liboqs-python. The custom KEMs need an extra (python-flint):

pip install "modularot[custom-kems]"

Usage

from modularot import run_ot, oqs_kem_factory, resolve_oqs

result = run_ot(
    make_kem=oqs_kem_factory("ML-KEM-768"),
    sampler=resolve_oqs("ML-KEM-768"),
    label="ML-KEM-768",
    choice=1,   # branch the receiver wants
    n=4,        # 1-out-of-4
)
assert result["ok"]      # receiver got the message it asked for
assert result["secure"]  # receiver could not open any other branch

Command line:

modularot run --kem ML-KEM-768 --n 3 --choice 1
modularot list-kems
modularot bench --ns 2 4 8 --csv out.csv

Other KEMs

Wrap the KEM in a KEMAdapter(gen, encap, decap) (all on bytes; encap returns (shared_secret, ciphertext)) and write a sampler real_pk -> oblivious_pk that returns a key in the same encoding as a real one, without running key generation. Then pass both to run_ot.

Limits

Semi-honest security only. NTRU_FO and GGH_FO are research code, not quantum-safe or production-ready.

Metadata

Release files for modularot 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modularot 0.1.0
File Size Uploaded Provenance Actions
modularot-0.1.0.tar.gz 22.8 kB Without provenance Details for modularot-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for modularot 0.1.0
File Interpreter ABI Platform Actions
modularot-0.1.0-py3-none-any.whl Python 3 none any Details for modularot-0.1.0-py3-none-any.whl

Total release size: 47.9 kB

Release files / modularot-0.1.0.tar.gz

Download URL modularot-0.1.0.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f0a2dd6ff7be777a5eef5eed15b286a81e43e23ea06c88da5db5362545903106
BLAKE2b-256 checksum
How to use checksums
ed5472e14f4aa34a6e7aa2a558b11505b3ed8e56866ef4e39784cff2a05f5153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Release files / modularot-0.1.0-py3-none-any.whl

Download URL modularot-0.1.0-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f768bd02fee5e14c92360c2a9579261031c4d770bef9e4981b0819387eae98f
BLAKE2b-256 checksum
How to use checksums
d8cb0ddf94965a33121faa9516cfffa505e20feaa8d11eb072d2e08a57fcc93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Security for modularot 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page