Function checkasum::hashing::hash_file

source ·
pub fn hash_file(
    hashing_method: &HashAlgorithm,
    file: &mut File
) -> Result<String, Error>
Expand description

Hashes a supplied file using the selected algorithm

§Examples

use std::fs::File;
use checkasum::hashing::hash_file;
use checkasum::hashing::HashAlgorithm::SHA256;

let mut file = File::create("tests/fixtures/tmp/foo.txt").unwrap();
let _file_hash = hash_file(&SHA256, &mut file);

§Errors

Bubbles up errors from file_reader Bubbles up errors from attempting file hashing