mod connection;
mod import;
mod lookup;
mod models;
mod schema;
pub use connection::{Database, DatabaseError};
pub use import::{ImportSource, Importer};
pub use lookup::{HashLookup, HetHashLookup};
pub use models::{ArchiveRecord, FileRecord, HashType};
use crate::crypto::{hash_string, hash_type, het_hash};
pub fn calculate_mpq_hashes(filename: &str) -> (u32, u32, u32) {
let normalized = filename.replace('/', "\\").to_uppercase();
let hash_a = hash_string(&normalized, hash_type::NAME_A);
let hash_b = hash_string(&normalized, hash_type::NAME_B);
let hash_offset = hash_string(&normalized, hash_type::TABLE_OFFSET);
(hash_a, hash_b, hash_offset)
}
pub fn calculate_het_hashes(filename: &str, hash_bits: u8) -> (u64, u64) {
let normalized = filename.replace('/', "\\");
let (file_hash, name_hash_u8) = het_hash(&normalized, hash_bits as u32);
(file_hash, name_hash_u8 as u64)
}