bitcoinjs / merkle-lib

A performance conscious library for merkle root and tree calculations.
MIT License
29 stars 17 forks source link

Leafs hashing #9

Closed ghost closed 4 years ago

ghost commented 4 years ago

Based on the note that you describe

This implementation is vulnerable to a forgery attack as a second pre-image attack, see these[1][2] crypto.stackexchange questions for an explanation. To avoid this vulnerability, you should pre-hash your leaves using a different hash function than the function provided such that H(x) != H'(x).

Do I have to add data to the leaf data or do I have to use a different hash for the leafs?

Regards