reposcry_cache/file_hasher.rs
1use std::path::Path;
2
3pub struct FileHasher;
4
5impl FileHasher {
6 pub fn hash_file(path: &Path) -> anyhow::Result<String> {
7 let data = std::fs::read(path)?;
8 Ok(blake3::hash(&data).to_hex().to_string())
9 }
10
11 pub fn hash_bytes(data: &[u8]) -> String {
12 blake3::hash(data).to_hex().to_string()
13 }
14}