Function blake2b_simd::many::hash_many[][src]

pub fn hash_many<'a, 'b, I>(hash_many_jobs: I) where
    'b: 'a,
    I: IntoIterator<Item = &'a mut HashManyJob<'b>>, 
Expand description

Hash any number of complete inputs all at once.

This is slightly more efficient than using update_many with State objects, because it doesn’t need to do any buffering.

Running hash_many on the same HashManyJob object more than once has no effect.

Example

use blake2b_simd::{blake2b, Params, many::{HashManyJob, hash_many}};

let inputs = [
    &b"foo"[..],
    &b"bar"[..],
    &b"baz"[..],
    &b"bing"[..],
];

let mut params = Params::new();
params.hash_length(16);

let mut jobs = [
    HashManyJob::new(&params, inputs[0]),
    HashManyJob::new(&params, inputs[1]),
    HashManyJob::new(&params, inputs[2]),
    HashManyJob::new(&params, inputs[3]),
];

hash_many(jobs.iter_mut());

for (input, job) in inputs.iter().zip(jobs.iter()) {
    let expected = params.hash(input);
    assert_eq!(expected, job.to_hash());
}