kesto/poseidon-lengths/go/length_test.go
poseidon-lengths/go/length_test.goRaw
1package main
2
3import (
4 "encoding/hex"
5 "fmt"
6 "testing"
7
8 "github.com/iden3/go-iden3-crypto/poseidon"
9)
10
11func TestLen(t *testing.T) {
12 m := []byte("45")
13 h, err := poseidon.HashBytes(m)
14 if err != nil {
15 t.Fatal(err)
16 }
17 fmt.Println("bigint", h.String())
18 fmt.Println("length", len(h.Bytes()))
19 fmt.Println("bytes", h.Bytes())
20 fmt.Println("hex", hex.EncodeToString(h.Bytes()))
21 if len(h.Bytes()) != 31 {
22 t.Fatal("expected 31 bytes")
23 }
24
25}