https://github.com/zemyblue/govrf
Golang wrapper of VRF included libsodium
https://github.com/zemyblue/govrf
Last synced: 10 months ago
JSON representation
Golang wrapper of VRF included libsodium
- Host: GitHub
- URL: https://github.com/zemyblue/govrf
- Owner: zemyblue
- Created: 2020-01-16T05:27:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-24T07:14:25.000Z (about 6 years ago)
- Last Synced: 2025-03-10T16:46:47.576Z (over 1 year ago)
- Language: C
- Size: 1.56 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# goVRF
This is VRF library of golang version
I forked [algorand's libsodium](https://github.com/algorand/libsodium) and extract only vrf module from go-algorand.
### How to compile libsodium of algorand
```shell script
cd ./crypto/libsodium
./autogen.sh
./configure
make && make check
sudo make install
```
And then, libsodium installed under /usr/local/lib/ if MacOS.
### Build and Test
```shell script
go build
go test -v
```
# VRF Types
```go
type VrfPrivkey [64]uint8
type VrfPubkey [32]uint8
```
# VRF functions
## make private key and public key
```go
func VrfKeygenFromSeed(seed [32]byte) (pub VrfPubkey, priv VrfPrivkey)
func VrfKeygen() (pub VrfPubkey, priv VrfPrivKey)
```
## VrfPrivKey
```go
func (sk VrfPrivkey) Pubkey() (pk VrfPubkey)
func (sk VrfPrivkey) Prove(message []byte) (proof VrfProof, ok bool)
func (proof VrfProof) Hash() (hash VrfOutput, ok bool)
```
## VrfPubKey
```go
func (pk VrfPubkey) Verify(p VrfProof, message []byte) (bool, VrfOutput
```