My code like:
use sha2::{Digest, Sha256};
use std::{fs::File, io};
pub fn sha256_by_file_path(file_path: &str) -> String {
let file = File::open(file_path);
let mut hasher = Sha256::new();
io::copy(&mut file, &mut hasher).unwrap();
let hash = hasher.finalize();
let fh = format!("{:x}", hash);
return fh;
}
I would like to get a sha256 of the part of the whole file.
For example, there is a file has 123456789 bytes, I want get the sha256 of the range 100 to 1234567800.
Thank you.