Cryptomite: A versatile and user-friendly library of randomness extractors
Cameron Foreman, Richie Yeung, Alec Edgington, Florian J. Curchod
TL;DR
Cryptomite presents a modern library for randomness extraction that unifies several state-of-the-art extractors (Circulant, Dodis et al., Toeplitz, Trevisan, and Von Neumann) under a Python/C++ framework. It emphasizes practical, numerically precise extraction using the number-theoretic transform (NTT) to avoid floating-point rounding errors, enabling input lengths up to $2^{40}$ bits and offering quasi-linear time performance for core constructions. The paper develops new theory and extensions (product-source and Markov-model security, near-perfect seeds, smooth min-entropy, and extractor composition) and provides parameter-calculation utilities and usage guidance, including concrete code examples for quantum key distribution privacy amplification and randomness generation. The work demonstrates the library’s practicality through benchmarking, clear API design, and public availability, aiming to simplify extractor selection and deployment in cryptographic protocols and RNG systems.
Abstract
We present Cryptomite, a Python library of randomness extractor implementations. The library offers a range of two-source, seeded and deterministic randomness extractors, together with parameter calculation modules, making it easy to use and suitable for a variety of applications. We also present theoretical results, including new extractor constructions and improvements to existing extractor parameters. The extractor implementations are efficient in practice and tolerate input sizes of up to $2^{40}>10^{12}$ bits. Contrary to alternatives using the fast Fourier transform, we implement convolutions efficiently using the number-theoretic transform to avoid rounding errors, making them well suited to cryptography. The algorithms and parameter calculation are described in detail, including illustrative code examples and performance benchmarking.
