Function tree_hash::merkleize_standard
source · pub fn merkleize_standard(bytes: &[u8]) -> Hash256
Expand description
Merkleizes bytes and returns the root, using a simple algorithm that does not optimize to avoid processing or storing padding bytes.
Note: This function is generally worse than using the crate::merkle_root
which uses
MerkleHasher
. We only keep this function around for reference testing.
The input bytes
will be padded to ensure that the number of leaves is a power-of-two.
CPU Performance
Will hash all nodes in the tree, even if they are padding and pre-determined.
Memory Performance
- Duplicates the input
bytes
. - Stores all internal nodes, even if they are padding.
- Does not free up unused memory during operation.