stsch9 / pyvrf-r255

Verifiable random function with Ristretto255

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyvrf-r255

This is a simple python implementation of
c2sp.org/vrf-r255.

It uses pysodium for all Ristretto255 functions. Therefore it requires a pre-installed libsodium from:
https://github.com/jedisct1/libsodium

Usage:

# Use your own private Key
vrf = ECVRF(bytes.fromhex('3431c2b03533e280b23232e280b34e2c3132c2b03238e280b23131e280b34500'))

# or create a random private Key
vrf = ECVRF.random_key()

# Get the secret Key
sk = vrf.secret_key

# Get the public Key
pk = vrf.public_key

# Get proof and hash for a message
pi, beta = vrf.hash(b'bla')

# Verify
print(vrf.verify(pk, b'bla', pi, beta))

About

Verifiable random function with Ristretto255


Languages

Language:Python 100.0%