arb_hash 0.1.1

Arbitrary block length hash function, potentially cryptographically secure.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub fn xor_blocks(a: &[u8], b: &[u8]) -> Vec<u8> {
    let len = a.len().min(b.len());
    (0..len).map(|i| a[i] ^ b[i]).collect()
}

pub fn inc_block(a: &mut [u8]) {
    for elem in a {
        *elem = elem.wrapping_add(1);
        if *elem != 0 {
            return;
        }
    }
}