[][src]Function blake2s_simd::many::hash_many

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

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 will panic in debug mode.

Example

use blake2s_simd::{blake2s, 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());
}