Verifiable random functions
Prove and verify keyed hash outputs with a public key (RFC 9381).
A verifiable random function (VRF) maps an input alpha to an output beta
with a private key, together with a proof pi that anyone with the public
key can check.
- ECVRF ECVRF-RISTRETTO255-SHA512.
Private keys come from generate() (operating system RNG) or
load_private_bytes(data). Keys cannot be copied or pickled. Private key
equality is constant time. Invalid keys and wrong-length proofs raise
ValueError; arguments that are not bytes raise TypeError.
Upstream and status
| Standard | RFC 9381 ECVRF construction (Informational, IRTF CFRG, August 2023); the ristretto255 ciphersuite is specified by C2SP vrf-r255, not by RFC 9381 itself |
| Crate | vrf-r255 0.1.0 (stable 0.x), MIT OR Apache-2.0, by Jack Grigg (str4d/vrf-r255) |
| Audit | No published audit |
| MSRV | Rust 1.60 (builds and passes clippy with oxcrypto's 1.88 toolchain) |
| Experimental | Yes: the ciphersuite is a C2SP specification outside RFC 9381 |
| Vectors | C2SP vrf-r255 test vector (also in vrf-r255 src/lib.rs) |
vrf-r255 uses curve25519-dalek 4 and sha2 0.10, so oxcrypto builds a second
copy of these crates next to the versions used elsewhere. Constant-time
behavior comes from vrf-r255 and curve25519-dalek; oxcrypto has not
verified it independently.
Zeroization
vrf_r255::SecretKey is Copy and does not zeroize. oxcrypto therefore does
not keep it: a private key object holds only the 32 scalar bytes in a
zeroizing buffer, plus the public key. Each prove call rebuilds the upstream
key from those bytes.
Zeroization does not cover:
- Inputs, keys, proofs and outputs as Python
bytes. - Short-lived copies inside
vrf-r255during a call: the rebuiltSecretKey(scalar copies, including insideCtOption), the SHA-512 nonce hash state and noncek, and scalar temporaries on the stack or in registers.vrf-r2550.1.0 has nozeroizesupport (upstream: str4d/vrf-r255).
Treat zeroization as defense in depth. It does not guarantee that secrets are gone from process memory.