Go library that bundles libsodium and provides wrappers for its Ristretto group functions. This library is based on the python implementation of the same.
This library is available via go get
:
go get github.com/bengetch/rbcl
And can be imported in the usual way:
import (
"github.com/bengetch/rbcl"
)
This library exports Go wrappers for constructors, point arithmetic functions, and scalar arithmetic functions. Some usage examples are presented below:
import (
"github.com/bengetch/rbcl"
)
p := CryptoCoreRistretto255Random()
v := CryptoCoreRistretto255IsValidPoint(p) // true
t := CryptoCoreRistretto255Random()
pt, err := CryptoCoreRistretto255Add(p, t)
tp, err := CryptoCoreRistretto255Add(t, p)
e1 := pt == tp // true
s := CryptoCoreRistretto255ScalarRandom()
r := CryptoCoreRistretto255ScalarRandom()
sr, err := CryptoCoreRistretto255ScalarMul(s, r)
rs, err := CryptoCoreRistretto255ScalarMul(r, s)
e2 := sr == rs // true
Further examples can be seen in the test files.
Development of this library requires libsodium source code, a pinned version of which is included in this repo as a submodule. Before developing features on a branch, then, ensure that you've pulled libsodium correctly via:
git clone https://github.com/bengetch/rbcl.git
cd rbcl
git submodule update --init --recursive
If you have already cloned this repository, and the libsodium
distribution inside of it has been
updated:
git submodule update --recursive --remote
Tests can be executed in the normal way:
go test .
As well as linting:
golangci-lint run .
Need to extend the release.yml
actions file to test and lint source code before pushing a new version.