page hash aggregation method improvement

This commit is contained in:
sreedevk
2025-07-14 01:01:14 +00:00
parent 48e7c62036
commit e1b81b9981

View File

@@ -19,11 +19,10 @@ impl FileInfo {
pub fn hash(&self, seed: i64) -> Result<u128> {
let file = fs::File::open(&self.path)?;
let mapper = unsafe { Mmap::map(&file)? };
let final_hash = mapper.chunks(4096).fold(0u128, |acc, chunk: &[u8]| {
acc.wrapping_add(gxhash128(chunk, seed))
});
Ok(final_hash)
Ok(mapper
.chunks(4096)
.fold(0u128, |acc, chunk: &[u8]| acc ^ gxhash128(chunk, seed)))
}
pub fn initial_page_hash(&self, seed: i64) -> Result<u128> {