[][src]Function keccak_hash::keccak512_range

pub fn keccak512_range(data: &mut [u8], range: Range<usize>)

Computes in-place keccak512 hash of data[range].

The range argument specifies a subslice of data in bytes to be hashed. The resulting hash will be written back to data.

Panics

If range is out of bounds.

Example

let mut data = [1u8; 64];
keccak_hash::keccak512_range(&mut data, 0..8);
let expected = [
    0x90, 0x45, 0xc5, 0x9e, 0xd3, 0x0e, 0x1f, 0x42, 0xac, 0x35, 0xcc, 0xc9, 0x55, 0x7c, 0x77, 0x17,
    0xc8, 0x89, 0x3a, 0x77, 0x6c, 0xea, 0x2e, 0xf3, 0x88, 0xea, 0xe5, 0xc0, 0xea, 0x40, 0x26, 0x64,
];
assert_eq!(&data[..32], &expected);