use sha2::{Digest, Sha256};
use std::io::Read;
use std::path::Path;
pub fn sha256_file(path: &Path) -> anyhow::Result<String> {
let mut file = std::fs::File::open(path)?;
let mut hasher = Sha256::new();
let mut buf = [0u8; 64 * 1024];
loop {
let n = file.read(&mut buf)?;
if n == 0 {
break;
}
hasher.update(&buf[..n]);
}
Ok(hex::encode(hasher.finalize()))
}