Hash Utilities
Overview
Functions
verify_file_sha1
pub async fn verify_file_sha1(path: &Path, expected_sha1: &str) -> HashResult<bool>use lighty_core::hash::verify_file_sha1;
use std::path::Path;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let is_valid = verify_file_sha1(
Path::new("minecraft-1.21.1.jar"),
"abc123def456..."
).await?;
if is_valid {
println!("✓ File integrity verified");
} else {
println!("✗ Hash mismatch!");
}
Ok(())
}verify_file_sha1_streaming
calculate_file_sha1_sync
verify_file_sha1_sync
calculate_sha1_bytes
calculate_sha1_bytes_raw
Error Handling
Usage in Download System
Performance Comparison
Small Files (< 10MB)
Medium Files (10MB - 100MB)
Large Files (> 100MB)
Case Insensitivity
Exports
Related Documentation
Last updated