Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this implementation safe against second preimage attacks? #13

Open
void4 opened this issue Oct 27, 2018 · 5 comments
Open

Is this implementation safe against second preimage attacks? #13

void4 opened this issue Oct 27, 2018 · 5 comments

Comments

@void4
Copy link

void4 commented Oct 27, 2018

@LucaPaterlini
Copy link

#16

@andreaskern
Copy link

andreaskern commented Mar 7, 2019

Yes, but!

add_leaf() should per default apply a hash to the value, even if it is a list

so instead of add_leaf(value, do_hash) it should really be add_leaf(value, do_not_hash)

if you don't hash the leaf of a merkle tree you are not applying the correct merkle tree algorithm.

or even better add add_node(hash), make add_node([hash]) illegal, make a add_nodes([hash]), make add_leaf() always apply hash to the value, make add_leaves([value]) map the hash function over the list first.

@andreaskern
Copy link

After Re Reading the attack it should be possible.

So it is not safe.

@void4
Copy link
Author

void4 commented Mar 11, 2019

Can you add a note about this in the README?

@jdbertron
Copy link

This is from 2018 and still not fixed. Any chance you'll fix this with a 0x00 prefix for leaves and a 0x01 prefix for branches ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants