Skip to Content
oxcrypto

VOPRF

RFC 9497 verifiable oblivious PRF.

from oxcrypto.oprf.voprf import VOPRF

algorithm = VOPRF.P256_SHA256
key = algorithm.generate()
public_key = algorithm.load_public_bytes(key.public_key().to_bytes())

client = algorithm.blind(b"input")
evaluated, proof = key.blind_evaluate(client.blinded_element)
output = client.finalize(evaluated, proof, public_key)
assert output == key.evaluate(b"input")

finalize raises ValueError if the proof does not verify against public_key, or if public_key belongs to a different ciphersuite.