pub fn get_sha3_256_hash(data: Vec<u8>) -> Result<String, Box<dyn Error>>
Expand description

Get SHA3-256 Hash from data. File needs to be read as Vec (e.g. use enc_file::read_file()). Returns result.

§Examples

use enc_file::{get_sha3_256_hash, read_file};

//creating to different Vec<u8> to hash and compare
let test = b"Calculating the the SHA3-256 Hash of this text".to_vec();
let test2 = b"Calculating the SHA3-256 Hash of this different text".to_vec();

//hashing 2x test and 1x test2 to compare the hashes. hash1 == hash2 != hash3
let hash1 = get_sha3_256_hash(test.clone()).unwrap();
let hash2 = get_sha3_256_hash(test).unwrap();
let hash3 = get_sha3_256_hash(test2).unwrap();
assert_eq!(hash1, hash2);
assert_ne!(hash1, hash3);