fn compute_hash_tree(mut hashes: Vec<Digest>) -> Digest {
    assert!(
        !hashes.is_empty(),
        "even an empty file will produce a digest. this function assumes that hashes is non-empty"
    );
    while hashes.len() > 1 {
        let next = hashes.chunks(2).into_iter().map(|chunk| match *chunk {
            [left, right] => {
                let mut ctx = Context::new(&SHA256);
                ctx.update(left.as_ref());
                ctx.update(right.as_ref());
                ctx.finish()
            }
            [last] => last,
            _ => unreachable!(),
        });
        hashes = next.collect();
    }
    hashes[0]
}
/// Compute the glacier tree hash for a vector of hashes.
///
/// Adjacent hashes are combined into a single hash. This process occurs recursively until only 1 hash remains.
///
/// See <https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html> for more information.
Compute the glacier tree hash for a vector of hashes.
Adjacent hashes are combined into a single hash. This process occurs recursively until only 1 hash remains.

See  for more information.
Compute the glacier tree hash for a vector of hashes . Adjacent hashes are combined into a single hash . This process occurs recursively until only 1 hash remains . See for more information .
fn compute_hash_tree(mut hashes: Vec<Digest>) -> Digest {
    assert!(
        !hashes.is_empty(),
        "even an empty file will produce a digest. this function assumes that hashes is non-empty"
    );
    while hashes.len() > 1 {
        let next = hashes.chunks(2).into_iter().map(|chunk| match *chunk {
            [left, right] => {
                let mut ctx = Context::new(&SHA256);
                ctx.update(left.as_ref());
                ctx.update(right.as_ref());
                ctx.finish()
            }
            [last] => last,
            _ => unreachable!(),
        });
        hashes = next.collect();
    }
    hashes[0]
}
fn compute_hash_tree ( mut hashes : Vec < Digest > ) -> Digest { assert ! ( hashes is_empty ( ) " " ) ; while hashes . len ( ) > 1 { let next = hashes . chunks ( 2 ) . into_iter ( ) . map ( | chunk | match * chunk { [ left , right ] => { let mut ctx = Context :: new ( & SHA256 ) ; ctx . update ( left . as_ref ( ) ) ; ctx . update ( right . as_ref ( ) ) ; ctx . finish ( ) } [ last ] => last , _ => unreachable ! ( ) , } ) ; hashes = next . collect ( ) ; } hashes [ 0 ] }
Compute the glacier tree hash for a vector of hashes.
Compute the glacier tree hash for a vector of hashes .
hashes
Vec<Digest>
hashes
Vec<Digest>