Crates.io | forge_hasher |
lib.rs | forge_hasher |
version | 0.1.3 |
source | src |
created_at | 2019-10-12 02:20:01.535663 |
updated_at | 2019-10-21 00:19:00.638811 |
description | The rust language implementation of forge_hasher |
homepage | https://github.com/ArcBlock/forge-rust-sdk |
repository | https://github.com/ArcBlock/forge-rust-sdk |
max_upload_size | |
id | 171820 |
size | 13,950 |
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].
hash(
input: &[u8],
hash_type: Option<HashType>,
len: Option<HashLen>,
hash_round: Option<u8>,
) -> Result<Vec<u8>>
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);