Function get_hash_file

Source
pub fn get_hash_file<HashType, P>(
    path: P,
    hash: &mut HashType,
) -> Result<String, Error>
where HashType: DynDigest + Clone, P: AsRef<Path>,
Expand description

Get hash from file

ยงExample

use std::path::PathBuf;
use blake2::{Blake2s256, Digest};
use file_hashing::get_hash_file;

let path = PathBuf::from("/home/gladi/test-hashing.txt");

let mut hash = Blake2s256::new();
let result = get_hash_file(&path, &mut hash).unwrap();

assert_eq!(result.len(), 64); // Blake2s256 len == 64