|
@ -66,7 +66,7 @@ func TestPoseidon(t *testing.T) { |
|
|
assert.Equal(t, "10747013384255785702102976082726575658403084163954725275481577373644732938016", hmsg2.String()) |
|
|
assert.Equal(t, "10747013384255785702102976082726575658403084163954725275481577373644732938016", hmsg2.String()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func TestPoseidonBroken(t *testing.T) { |
|
|
|
|
|
|
|
|
func TestPoseidonBrokenChunks(t *testing.T) { |
|
|
h1, err := Hash([]*big.Int{big.NewInt(0), big.NewInt(1), big.NewInt(2), big.NewInt(3), big.NewInt(4), |
|
|
h1, err := Hash([]*big.Int{big.NewInt(0), big.NewInt(1), big.NewInt(2), big.NewInt(3), big.NewInt(4), |
|
|
big.NewInt(5), big.NewInt(6), big.NewInt(7), big.NewInt(8), big.NewInt(9)}) |
|
|
big.NewInt(5), big.NewInt(6), big.NewInt(7), big.NewInt(8), big.NewInt(9)}) |
|
|
assert.Nil(t, err) |
|
|
assert.Nil(t, err) |
|
@ -76,6 +76,14 @@ func TestPoseidonBroken(t *testing.T) { |
|
|
assert.NotEqual(t, h1, h2) |
|
|
assert.NotEqual(t, h1, h2) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestPoseidonBrokenPadding(t *testing.T) { |
|
|
|
|
|
h1, err := Hash([]*big.Int{big.NewInt(1)}) |
|
|
|
|
|
assert.Nil(t, err) |
|
|
|
|
|
h2, err := Hash([]*big.Int{big.NewInt(1), big.NewInt(0)}) |
|
|
|
|
|
assert.Nil(t, err) |
|
|
|
|
|
assert.NotEqual(t, h1, h2) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func BenchmarkPoseidon(b *testing.B) { |
|
|
func BenchmarkPoseidon(b *testing.B) { |
|
|
b12 := big.NewInt(int64(12)) |
|
|
b12 := big.NewInt(int64(12)) |
|
|
b45 := big.NewInt(int64(45)) |
|
|
b45 := big.NewInt(int64(45)) |
|
|