This is a very simple wrapper around algorand forked libsodium with vrf.
$ git clone https://github.com/algorand/libsodium
$ cd libsodium
$ ./autogen.sh
$ make && make check
$ sudo make install
$ git clone https://github.com/hamstory/pyvrf
$ cd pyvrf
$ pip install .
pyvrf.crypto_vrf_secretkeybytes # 64
pyvrf.crypto_vrf_publickeybytes # 32
pyvrf.crypto_vrf_seedbytes # 32
pyvrf.crypto_vrf_proofbytes # 80
pyvrf.crypto_vrf_outputbytes # 64
Note that secret key is 64 byte. Here, secret key consists of seed(32byte) + public key(32byte).
import pyvrf
pk, sk = pyvrf.crypto_vrf_keypair()
print(pk.hex())
print(sk.hex())
More usages are in tests/test_pyvrf.py
Internally generates a random seed and generates a secret key and a public key.
Creates a secret key and a public key with the given random seed.
Ensure that the public key is a valid key.
Create a proof with a secret key and a message.
Use the generated proof to get a random hash. This function does not validate the proof. To verify and get the random hash, you should use the crypto_vrf_verify
function.
Verify the proof with the message, public key and get the random hash coming out of the proof.
Get the public key from the secret key
Get the seed from the secret key