merkletree
merkletree copied to clipboard
Added optional sorting before each sibling hashing
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.
Please review this PR. Sounds like a savior for me! The merkle tree algorithm in OpenZeppelin requires the hashing pairs to be sorted.
Better late than never?
-C
I have become an OS contributor! thank you @cbergoon