ableos_userland/libraries/cryptography/src/hashing/mod.rs

11 lines
229 B
Rust

pub fn checksum<T: AsRef<[u8]>>(input: T) -> u64 {
let input_bytes = input.as_ref();
let mut checksum: u64 = 0;
for &byte in input_bytes {
checksum = checksum.wrapping_add(byte as u64);
}
checksum
}