forge_hasher
implement by Rust
.
Hash algorithms support blake2b
,keccak
, sha2
, sha3
currently.
Hash len support 160
, 224
, 256
, 384
, 512
.
Hash round support [1, 100].
rust
hash(
input: &[u8],
hash_type: Option<HashType>,
len: Option<HashLen>,
hash_round: Option<u8>,
) -> Result<Vec<u8>>
rust
let message = b"hello rust";
let default_hash = hash(message,None,None,None)?;
let sha3_hash = hash(message, Some(HashType::Sha3), Some(HashLen::Len256), Some(1))?;
assert_eq!(sha3_hash, default_hash);