combine_hashes

Function combine_hashes 

Source
pub fn combine_hashes(hashes: Vec<Vec<u8>>) -> Vec<u8> 
Expand description

Combine the tree hashes from multiple parts (i.e. multiple invocations of calculate_tree_hash) into the overall tree hash.

§Example

let data = &[0u8; 7680000];
let tree_hash_1 = aws_tree_hash::calculate_tree_hash(&data[..2097152]);
let tree_hash_2 = aws_tree_hash::calculate_tree_hash(&data[2097152..4194304]);
let tree_hash_3 = aws_tree_hash::calculate_tree_hash(&data[4194304..6291456]);
let tree_hash_4 = aws_tree_hash::calculate_tree_hash(&data[6291456..]);

let res = aws_tree_hash::combine_hashes(vec![tree_hash_1, tree_hash_2, tree_hash_3, tree_hash_4]);

assert_eq!(
    res,
    Vec::from_hex("7a43777ddc7a0326d36b15bc482e6c7736e1c2e9d80a647e8c301646f6a4785c")
        .unwrap()
);