mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-05 23:03:06 +00:00
21 lines
468 B
Rust
21 lines
468 B
Rust
use rs_merkle::Hasher;
|
|
use sha2::{Digest, Sha256, digest::FixedOutput};
|
|
|
|
use super::TreeHashType;
|
|
|
|
#[derive(Debug, Clone)]
|
|
///Our own hasher.
|
|
/// Currently it is SHA256 hasher wrapper. May change in a future.
|
|
pub struct OwnHasher {}
|
|
|
|
impl Hasher for OwnHasher {
|
|
type Hash = TreeHashType;
|
|
|
|
fn hash(data: &[u8]) -> TreeHashType {
|
|
let mut hasher = Sha256::new();
|
|
|
|
hasher.update(data);
|
|
<TreeHashType>::from(hasher.finalize_fixed())
|
|
}
|
|
}
|