#forge #blake2b #sha-2

forge_hasher

The rust language implementation of forge_hasher

4 releases

0.1.3 Oct 21, 2019
0.1.2 Oct 16, 2019
0.1.1 Oct 14, 2019
0.1.0 Oct 12, 2019

#18 in #blake2b

24 downloads per month
Used in 4 crates

Apache-2.0

14KB
299 lines

forge_hasher introduction

Intro

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].

API

    hash(
        input: &[u8],
        hash_type: Option<HashType>,
        len: Option<HashLen>,
        hash_round: Option<u8>,
    ) -> Result<Vec<u8>>

Usage

    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);

Dependencies

~5.5MB
~65K SLoC