Closed absfox closed 5 years ago
Sounds like a great idea. I'd like to preserve the original API and create a new "New" function (e.g. NewTreeWithHashStrategy(list, sha256.New)
). The original NewTree(list)
function could set the default to the hash function that is currently used.
Cam
@absfox
I added the below function to allow the hash function to be configurable.
func NewTreeWithHashStrategy(cs []Content, hashStrategy func() hash.Hash) (*MerkleTree, error)
The default hash remains sha256.
I was wondering if you would be open to supporting a configurable hash function.
In other words pass the hash function as an argument along with the content list when building the tree. Something like:
merkle.NewTree(list, sha256.New)