freenet_scaffold/util.rs
1use serde::{Deserialize, Serialize};
2
3pub fn fast_hash(bytes: &[u8]) -> FastHash {
4 let mut hash: i64 = 0;
5 for &byte in bytes {
6 hash = hash.wrapping_mul(31).wrapping_add(byte as i64);
7 }
8 FastHash(hash)
9}
10
11#[derive(Serialize, Deserialize, Eq, PartialEq, Hash, Clone, Debug, Ord, PartialOrd, Copy)]
12pub struct FastHash(pub i64);