github.com/SteinsElite/zk-crypto@v0.0.0-20211230111215-7d347a540f29/poseidon/poseidon_test.go (about)

     1  package poseidon
     2  
     3  import (
     4  	"fmt"
     5  	"math/big"
     6  	"testing"
     7  )
     8  
     9  func TestHash(t *testing.T) {
    10  	param, _ := NewPoseidonParams(5, 6, 52, 128)
    11  	input := []*big.Int{
    12  		big.NewInt(1),
    13  		big.NewInt(2),
    14  		big.NewInt(3),
    15  		big.NewInt(4),
    16  	}
    17  	res, _ := Hash(input, *param)
    18  	t.Log(res)
    19  	fmt.Println("hash result is: ", res)
    20  }
    21  
    22  func BenchmarkHash(t *testing.B) {
    23  	param, _ := NewPoseidonParams(5, 6, 52, 128)
    24  	input := []*big.Int{
    25  		big.NewInt(1),
    26  		big.NewInt(2),
    27  		big.NewInt(3),
    28  		big.NewInt(4),
    29  	}
    30  	res, _ := Hash(input, *param)
    31  	t.Log(res)
    32  	fmt.Println("hash result is: ", res)
    33  }