Function bao::encode::encode_outboard[][src]

pub fn encode_outboard(input: &[u8], output: &mut [u8]) -> Hash

Encode the input bytes in the outboard mode. output.len() must be exactly outboard_size(input.len()).

If the std feature is enabled, as it is by default, this will use multiple threads via Rayon.

Panics

Panics if the output slice is the wrong length.

Example

let input = b"some bytes";
let outboard_size = bao::encode::outboard_size(input.len() as u64);
assert!(outboard_size <= usize::max_value() as u128);
// Note that if you're allocating a new Vec like this, encode_outboard_to_vec is more convenient.
let mut outboard = vec![0; outboard_size as usize];
bao::encode::encode_outboard(input, &mut outboard);