You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
444 B

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