1 2 3 4 5 6 7 8 9 10 11 12
use blake2::{Blake2b, Digest};
use std::path::Path;
use std::{fs, io};
pub fn file(path: &Path) -> io::Result<String> {
let mut file = fs::File::open(path)?;
let mut hasher = Blake2b::new();
io::copy(&mut file, &mut hasher)?;
let hash = hasher.finalize();
Ok(format!("{:x}", hash))
}