From 47b41d8ffca2c577555eb001cbe4693bc881ff8b Mon Sep 17 00:00:00 2001 From: Cool Developer Date: Tue, 15 Mar 2022 07:33:14 -0400 Subject: [PATCH] update the input params of hash --- goldenposeidon/constants.go | 11 ++++------- goldenposeidon/poseidon.go | 7 ++++++- goldenposeidon/poseidon_test.go | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/goldenposeidon/constants.go b/goldenposeidon/constants.go index bc652d6..1a952c4 100644 --- a/goldenposeidon/constants.go +++ b/goldenposeidon/constants.go @@ -3,13 +3,10 @@ package poseidon import "github.com/iden3/go-iden3-crypto/ffg" const ( - // NROUNDSF - NROUNDSF = 8 - // NROUNDSP - NROUNDSP = 22 - // CAPLEN - CAPLEN = 4 - mLen = 12 + NROUNDSF = 8 //nolint:golint + NROUNDSP = 22 //nolint:golint + CAPLEN = 4 //nolint:golint + mLen = 12 ) var ( diff --git a/goldenposeidon/poseidon.go b/goldenposeidon/poseidon.go index 8e7b851..c4be7ba 100644 --- a/goldenposeidon/poseidon.go +++ b/goldenposeidon/poseidon.go @@ -68,5 +68,10 @@ func Hash(inpBI [NROUNDSF]uint64, capBI [CAPLEN]uint64) ([CAPLEN]uint64, error) state = mix(state) } - return [CAPLEN]uint64{state[0].ToUint64Regular(), state[1].ToUint64Regular(), state[2].ToUint64Regular(), state[3].ToUint64Regular()}, nil + return [CAPLEN]uint64{ + state[0].ToUint64Regular(), + state[1].ToUint64Regular(), + state[2].ToUint64Regular(), + state[3].ToUint64Regular(), + }, nil } diff --git a/goldenposeidon/poseidon_test.go b/goldenposeidon/poseidon_test.go index 93412e6..cd108d6 100644 --- a/goldenposeidon/poseidon_test.go +++ b/goldenposeidon/poseidon_test.go @@ -47,7 +47,10 @@ func TestPoseidonHash(t *testing.T) { }, h, ) - h, err = Hash([NROUNDSF]uint64{bm1, bm1, bm1, bm1, bm1, bm1, bm1, bm1}, [CAPLEN]uint64{bm1, bm1, bm1, bm1}) + h, err = Hash( + [NROUNDSF]uint64{bm1, bm1, bm1, bm1, bm1, bm1, bm1, bm1}, + [CAPLEN]uint64{bm1, bm1, bm1, bm1}, + ) assert.Nil(t, err) assert.Equal(t, [CAPLEN]uint64{