Class: Merkle::BinaryTree

Inherits:
AbstractTree show all
Defined in:
lib/merkle/binary_tree.rb

Overview

Merkle trees take the same approach as Bitcoin to construct a complete binary tree. If the number of hashes in the list at a given level is odd, the last one is duplicated before computing the next level (which is unusual in Merkle trees). So keep in mind that this following merkle tree algorithm has a serious flaw related to duplicate elements, resulting in a vulnerability (CVE-2012-2459).

Instance Attribute Summary

Attributes inherited from AbstractTree

#config, #leaves

Method Summary

Methods inherited from AbstractTree

#compute_root, from_elements, #generate_proof, #initialize

Methods included from Util

#bin_to_hex, #combine_sorted, #hex_string?, #hex_to_bin

Constructor Details

This class inherits a constructor from Merkle::AbstractTree