How could I make a hash in vector format, with a vector of bytes? (without crypto-hash library)
I have a u8 vector with bytes and I would need a u8 vector with sha256 .
use sha2::{Sha256, Digest};
pub trait Hashable {
fn bytes (&self) -> Vec<u8>;
/// NEED TO IMPLEMENT THE HASH
fn hash (&self) -> Vec<u8>{
let mut hasher = Sha256::new();
hasher.update(&self.bytes);
let result = hasher.finalize();
println!("{:?}", result);
}
}
1 Answers