[][src]Function blake::hash

pub fn hash(hashbitlen: i32, data: &[u8], hashval: &mut [u8]) -> Result<()>

Hash all data in one fell swoop.

Refer to individual functions for extended documentation.

Example

let mut result_256 = [0; 32];
let mut result_512 = [0; 64];

blake::hash(256, &[], &mut result_256).unwrap();
blake::hash(512, &[], &mut result_512).unwrap();

assert_eq!(Vec::from_iter(result_256.iter().map(|&i| i)),
           vec![0x71, 0x6F, 0x6E, 0x86, 0x3F, 0x74, 0x4B, 0x9A,
                0xC2, 0x2C, 0x97, 0xEC, 0x7B, 0x76, 0xEA, 0x5F,
                0x59, 0x08, 0xBC, 0x5B, 0x2F, 0x67, 0xC6, 0x15,
                0x10, 0xBF, 0xC4, 0x75, 0x13, 0x84, 0xEA, 0x7A]);
assert_eq!(Vec::from_iter(result_512.iter().map(|&i| i)),
           vec![0xA8, 0xCF, 0xBB, 0xD7, 0x37, 0x26, 0x06, 0x2D,
                0xF0, 0xC6, 0x86, 0x4D, 0xDA, 0x65, 0xDE, 0xFE,
                0x58, 0xEF, 0x0C, 0xC5, 0x2A, 0x56, 0x25, 0x09,
                0x0F, 0xA1, 0x76, 0x01, 0xE1, 0xEE, 0xCD, 0x1B,
                0x62, 0x8E, 0x94, 0xF3, 0x96, 0xAE, 0x40, 0x2A,
                0x00, 0xAC, 0xC9, 0xEA, 0xB7, 0x7B, 0x4D, 0x4C,
                0x2E, 0x85, 0x2A, 0xAA, 0xA2, 0x5A, 0x63, 0x6D,
                0x80, 0xAF, 0x3F, 0xC7, 0x91, 0x3E, 0xF5, 0xB8]);