A Go implementation of Algorand’s subset-sum hash function.
The library exports the subset sum hash function via a hash.Hash
interface.
go get github.com/algorand/go-sumhash
Alternatively the same can be achieved if you use import in a package:
import "github.com/algorand/go-sumhash"
and run go get without parameters.
Construct a sumhash instance with block size of 512.
package main
import (
"fmt"
"github.com/algorand/go-sumhash"
)
func main() {
h := sumhash.New512(nil)
input := []byte("sumhash input")
_, _ = h.Write(input)
sum := h.Sum(nil)
fmt.Printf("subset sum hash value: %X", sum)
}
go test ./...
The specification of the function as well as the security parameters can be found here