Files
kesto/poseidon-lengths/go/length_test.go
2020-04-19 14:13:54 +02:00

26 lines
444 B
Go

package main
import (
"encoding/hex"
"fmt"
"testing"
"github.com/iden3/go-iden3-crypto/poseidon"
)
func TestLen(t *testing.T) {
m := []byte("45")
h, err := poseidon.HashBytes(m)
if err != nil {
t.Fatal(err)
}
fmt.Println("bigint", h.String())
fmt.Println("length", len(h.Bytes()))
fmt.Println("bytes", h.Bytes())
fmt.Println("hex", hex.EncodeToString(h.Bytes()))
if len(h.Bytes()) != 31 {
t.Fatal("expected 31 bytes")
}
}