merkletree icon indicating copy to clipboard operation
merkletree copied to clipboard

Added optional sorting before each sibling hashing

Open daragao opened this issue 4 years ago • 1 comments

I was using this library and wanted to make it work with a popular Ethereum framework called OpenZeppelin

Unfortunately their Merkle Proof verification expects for each hashed sibling pair to have been ordered before (here). Not a very good idea since merkiling A and B becomes the same as B and A. But since it is a very popular library for Ethereum thought this pull request might be acceptable.

(maybe more test would be good from my part)

I preferred to create a new method instead of deleting an already known one, but it is only one more argument.

daragao avatar Nov 21 '19 17:11 daragao

Please review this PR. Sounds like a savior for me! The merkle tree algorithm in OpenZeppelin requires the hashing pairs to be sorted.

theobmgit avatar Aug 16 '22 07:08 theobmgit

Better late than never?

-C

cbergoon avatar Feb 01 '23 13:02 cbergoon

I have become an OS contributor! thank you @cbergoon

daragao avatar Feb 01 '23 13:02 daragao