1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-21 04:07:46 +00:00

Add calculate_partial_hash function

This commit is contained in:
Joshua Goins 2023-10-12 18:59:44 -04:00
parent 0896ef829c
commit 5c5d2f85bb

View file

@ -11,6 +11,13 @@ use crate::dat::{BlockHeader, CompressionMode};
const CRC: Jamcrc = Jamcrc::new(); const CRC: Jamcrc = Jamcrc::new();
/// Calculates a partial hash for a given path
pub fn calculate_partial_hash(path: &str) -> u32 {
let lowercase = path.to_lowercase();
CRC.checksum(lowercase.as_bytes())
}
/// Calculates a hash for `index` files from a game path. /// Calculates a hash for `index` files from a game path.
pub fn calculate_hash(path: &str) -> u64 { pub fn calculate_hash(path: &str) -> u64 {
let lowercase = path.to_lowercase(); let lowercase = path.to_lowercase();