Skip to main content

A reference implementation for testing & validating Privacy Amplification algorithms

Project description

randExtract logo

The randextract library is a Python 3 package implementing randomness extractors that can be used to transform weak random sources into almost-uniform ones. The library implements quantum-proof strong randomness extractors that can be used in the Privacy Amplification (PA) step of any Quantum Key Distribution (QKD) or Quantum Random Number Generator (QRNG) protocol. Since quantum-proof strong randomness extractors are also classical-proof, these extractors are also well-suited for applications that involve only classical or no side-information at all.

Our goal is to provide an easy-to-read reference library, whose correctness can be easily verified, that can be used to validate high performance implementations (usually hardware based) that are more difficult to audit and test.

Structure of the repo

  • src/randextract: source code of the library.
  • tests: unit and integration tests.
  • docs/source: source code of the online documentation.
  • examples: scripts validating real world privacy amplification implementations.
  • resources: additional resources such as plots, datasets used in testing and the scripts to generate them, Jupyter notebooks, test vectors, etc.

Build & Install

You can install the latest release of the package using pip:

pip install randextract

Alternatively, you can install the current dev version cloning this git repo:

git clone https://github.com/cryptohslu/randextract.git
cd randextract
# (Optionally, create a virtual environment)
python -m venv .venv
source .venv/bin/activate
pip install .

Documentation

The documentation is available at https://randextract.crypto-lab.ch.

You can also build the documentation locally:

cd docs
make html

Citation & Contact

If randextract was useful to you in your research, please cite us.

BibTeX

@misc{randextract,
  title={randextract: a Reference Library to Test and Validate Privacy Amplification Implementations}, 
  author={Iyán Méndez Veiga and Esther Hänggi},
  year={2025},
  eprint={2506.00124},
  archivePrefix={arXiv},
  primaryClass={quant-ph},
  url={https://arxiv.org/abs/2506.00124},
}

If you want to collaborate with us at the please send us an email.

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

randextract-0.2.2.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

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

randextract-0.2.2-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file randextract-0.2.2.tar.gz.

File metadata

  • Download URL: randextract-0.2.2.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for randextract-0.2.2.tar.gz
Algorithm Hash digest
SHA256 fd6f9a1a8fe967a4ada4eb88e48195710d0109a9320477e630d5391bc5ca490d
MD5 a8cf5b6b5eb3beb4e163ea2c94563602
BLAKE2b-256 57c24dc772e030948eadd5794ae9be3d2a62d23b6560bce76c4d786d91fe957e

See more details on using hashes here.

File details

Details for the file randextract-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: randextract-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for randextract-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ebba411415fefe9c793db0094b42f5beddc42117845fb57d730f24d0b56b425
MD5 aa11c121e36a9f808c600e3ed692032a
BLAKE2b-256 04bcbdc01277b5bb9da15ae18bc4462fa4a30e36be22d9c2d21735e5a026c4f0

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