logo
Expand description

An implementation of the RIPEMD cryptographic hash.

This crate implements only the modified 1996 versions, not the original one from 1992.

Note that RIPEMD-256 provides only the same security as RIPEMD-128, and RIPEMD-320 provides only the same security as RIPEMD-160.

Usage

use hex_literal::hex;
use ripemd::{Ripemd160, Ripemd320, Digest};

// create a RIPEMD-160 hasher instance
let mut hasher = Ripemd160::new();

// process input message
hasher.update(b"Hello world!");

// acquire hash digest in the form of GenericArray,
// which in this case is equivalent to [u8; 20]
let result = hasher.finalize();
assert_eq!(result[..], hex!("7f772647d88750add82d8e1a7a3e5c0902a346a3"));

// same for RIPEMD-320
let mut hasher = Ripemd320::new();
hasher.update(b"Hello world!");
let result = hasher.finalize();
assert_eq!(&result[..], &hex!("
    f1c1c231d301abcf2d7daae0269ff3e7bc68e623
    ad723aa068d316b056d26b7d1bb6f0cc0f28336d
")[..]);

Also see RustCrypto/hashes readme.

Re-exports

pub use digest;

Structs

Core block-level RIPEMD-128 hasher state.
Core block-level RIPEMD-160 hasher state.
Core block-level RIPEMD-256 hasher state.
Core block-level RIPEMD-320 hasher state.

Traits

Convinience wrapper trait covering functionality of cryptographic hash functions with fixed output size.

Type Definitions

RIPEMD-128 hasher.
RIPEMD-160 hasher.
RIPEMD-256 hasher.
RIPEMD-320 hasher.