Skip to main content
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.

Metadata

Release files for randextract 0.2.2

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

Source distribution (sdist)

Source distribution for randextract 0.2.2
File Size Uploaded
randextract-0.2.2.tar.gz 37.2 kB Details

Built distribution (wheel)

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

Total release size: 80.4 kB

Release files / randextract-0.2.2.tar.gz

Download URL randextract-0.2.2.tar.gz
Size 37.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fd6f9a1a8fe967a4ada4eb88e48195710d0109a9320477e630d5391bc5ca490d
BLAKE2b-256 checksum
How to use checksums
57c24dc772e030948eadd5794ae9be3d2a62d23b6560bce76c4d786d91fe957e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / randextract-0.2.2-py3-none-any.whl

Download URL randextract-0.2.2-py3-none-any.whl
Size 43.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ebba411415fefe9c793db0094b42f5beddc42117845fb57d730f24d0b56b425
BLAKE2b-256 checksum
How to use checksums
04bcbdc01277b5bb9da15ae18bc4462fa4a30e36be22d9c2d21735e5a026c4f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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