logo
pub fn hash_bytes<H>(input: &[u8], output: &mut <H as HashOutput>::Type)where
    H: CryptoHash,
Expand description

Conducts the crypto hash of the given input and stores the result in output.

Example

use ink_env::hash::{Sha2x256, HashOutput};
let input: &[u8] = &[13, 14, 15];
let mut output = <Sha2x256 as HashOutput>::Type::default(); // 256-bit buffer
let hash  = ink_env::hash_bytes::<Sha2x256>(input, &mut output);