Skip to content

Commit 2cb00a5

Browse files
authoredMay 29, 2017
README: add warnings
1 parent dc3975f commit 2cb00a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77

88
A performance conscious library for merkle root and tree calculations.
99

10-
**NOTE**: As is, this implementation is vulnerable to a forgery attack ([as a second pre-image attack](https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack)), see these[\[1\]](https://crypto.stackexchange.com/questions/2106/what-is-the-purpose-of-using-different-hash-functions-for-the-leaves-and-interna)[\[2\]](https://crypto.stackexchange.com/questions/43430/what-is-the-reason-to-separate-domains-in-the-internal-hash-algorithm-of-a-merkl/44971#44971) crypto.stackexchange questions for an explanation.
10+
11+
## Warnings
12+
This implementation is vulnerable to a forgery attack ([as a second pre-image attack](https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack)), see these[\[1\]](https://crypto.stackexchange.com/questions/2106/what-is-the-purpose-of-using-different-hash-functions-for-the-leaves-and-interna)[\[2\]](https://crypto.stackexchange.com/questions/43430/what-is-the-reason-to-separate-domains-in-the-internal-hash-algorithm-of-a-merkl/44971#44971) crypto.stackexchange questions for an explanation.
1113
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)`.
1214

15+
This implementation is vulnerable to a forgery attack ([for an unbalanced merkle tree](https://bitcointalk.org/?topic=102395)), wherein, in an unbalanced merkle tree, the last leaf node can be duplicated to create an artificial balanced tree, resulting in the same root hash.
16+
1317

1418
## Examples
1519
Preamble

0 commit comments

Comments
 (0)
Please sign in to comment.