|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"math/big" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
|
|
|
|
"github.com/iden3/go-iden3-core/common" |
|
|
@ -120,6 +121,16 @@ func NewHashFromBytes(b []byte) (*Hash, error) { |
|
|
|
return &h, nil |
|
|
|
} |
|
|
|
|
|
|
|
// NewHashFromHex returns a *Hash representation of the given hex string
|
|
|
|
func NewHashFromHex(h string) (*Hash, error) { |
|
|
|
h = strings.TrimPrefix(h, "0x") |
|
|
|
b, err := hex.DecodeString(h) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return NewHashFromBytes(b) |
|
|
|
} |
|
|
|
|
|
|
|
// MerkleTree is the struct with the main elements of the MerkleTree
|
|
|
|
type MerkleTree struct { |
|
|
|
sync.RWMutex |
|
|
|