mirror of
https://github.com/arnaucube/kesto.git
synced 2026-02-08 03:56:41 +01:00
Add poseidon-lengths test
This commit is contained in:
25
poseidon-lengths/go/length_test.go
Normal file
25
poseidon-lengths/go/length_test.go
Normal 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")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user