Add poseidon-lengths test

This commit is contained in:
arnaucube
2020-04-19 14:13:54 +02:00
parent 6424fca7bb
commit f71ffcbbfb
7 changed files with 101 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
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")
}
}