From 220afbff3599410764ea24219c84bbc1b3250b5d Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Tue, 10 Dec 2024 11:50:56 +0100 Subject: [PATCH] tree/smt Processor now uses poseidon.MultiHash --- tree/smt/hash.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tree/smt/hash.go b/tree/smt/hash.go index 2fc896b..f4b1c52 100644 --- a/tree/smt/hash.go +++ b/tree/smt/hash.go @@ -3,17 +3,25 @@ package smt import ( "github.com/consensys/gnark/frontend" - "github.com/mdehoog/poseidon/circuits/poseidon" + "github.com/vocdoni/gnark-crypto-primitives/hash/bn254/poseidon" ) // based on https://github.com/iden3/circomlib/blob/master/circuits/smt/smthash_poseidon.circom func Hash1(api frontend.API, key, value frontend.Variable) frontend.Variable { inputs := []frontend.Variable{key, value, 1} - return poseidon.Hash(api, inputs) + hash, err := poseidon.MultiHash(api, inputs...) + if err != nil { + panic(err) + } + return hash } func Hash2(api frontend.API, l, r frontend.Variable) frontend.Variable { inputs := []frontend.Variable{l, r} - return poseidon.Hash(api, inputs) + hash, err := poseidon.MultiHash(api, inputs...) + if err != nil { + panic(err) + } + return hash }