[−][src]Function enc_file::get_sha256_hash
pub fn get_sha256_hash(data: Vec<u8>) -> Result<String, Box<dyn Error>>
Get SHA256 Hash from data. File needs to be read as Vac
Examples
use enc_file::{get_sha256_hash, read_file}; //creating to different Vec<u8> to hash and compare let test = b"Calculating the BLAKE3 Hash of this text".to_vec(); let test2 = b"Calculating the BLAKE3 Hash of this different text".to_vec(); //hashing 2x test and 1x text2 to compare the hashes. hash1 == hash2 != hash3 let hash1 = get_sha256_hash(test.clone()).unwrap(); let hash2 = get_sha256_hash(test).unwrap(); let hash3 = get_sha256_hash(test2).unwrap(); assert_eq!(hash1, hash2); assert_ne!(hash1, hash3);