To prevent second pre-image attacks, the Merkle Tree implementations I've looked
at add a 0
prefix to the leaves and a 1
prefix to all other nodes as described
at the bottom of this link:
https://flawed.net.nz/2018/02/21/attacking-merkle-trees-with-a-second-preimage-attack/
If we assume the Merkle Tree is a Complete Binary Tree, where all the leaves are on
the same level and packed to the left, do we need to hash the leaves with
a 0
prefix? Can we instead prefix all interior nodes with the tree depth
as the article appears to hint at and not prefix the leaves? Am I missing something?