crypto_hashes/
lib.rs

1//! Collection of cryptographic hash functions written in pure Rust.
2//! This crate provides convenient re-exports from other crates. Additionally
3//! it's a `no_std` crate, so it can be easily used in embedded applications.
4//!
5//! # Supported algorithms
6//! * [BLAKE2](https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE2)
7//! * [GOST94](https://en.wikipedia.org/wiki/GOST_(hash_function))
8//!         (GOST R 34.11-94 and GOST 34.311-95) [weak]
9//! * [MD4](https://en.wikipedia.org/wiki/MD2) [weak]
10//! * [MD4](https://en.wikipedia.org/wiki/MD4) [weak]
11//! * [MD5](https://en.wikipedia.org/wiki/MD5) [weak]
12//! * [RIPEMD](https://en.wikipedia.org/wiki/RIPEMD)
13//! * [SHA-1](https://en.wikipedia.org/wiki/SHA-1) [weak]
14//! * [SHA-2](https://en.wikipedia.org/wiki/SHA-2)
15//! * [SHA-3](https://en.wikipedia.org/wiki/SHA-3)
16//! * [Streebog](https://en.wikipedia.org/wiki/Streebog) (GOST R 34.11-2012) [weak]
17//! * [Whirlpool](https://en.wikipedia.org/wiki/Whirlpool_(cryptography))
18//!
19//! Algorithms marked by [weak] are not included by default. To use them enable
20//! `include_weak` crate feature.
21//!
22//! # Usage
23//!
24//! ```rust
25//! use crypto_hashes::digest::Digest;
26//! use crypto_hashes::sha3::Sha3_256;
27//!
28//! // create a SHA3-256 object
29//! let mut hasher = Sha3_256::default();
30//!
31//! // write input message
32//! hasher.update(b"abc");
33//!
34//! // read result (this will consume hasher)
35//! let out = hasher.finalize();
36//!
37//! assert_eq!(out[..], [0x3a, 0x98, 0x5d, 0xa7, 0x4f, 0xe2, 0x25, 0xb2,
38//!                      0x04, 0x5c, 0x17, 0x2d, 0x6b, 0xd3, 0x90, 0xbd,
39//!                      0x85, 0x5f, 0x08, 0x6e, 0x3e, 0x9d, 0x52, 0x5b,
40//!                      0x46, 0xbf, 0xe2, 0x45, 0x11, 0x43, 0x15, 0x32]);
41//! ```
42#![no_std]
43#![doc(
44    html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
45    html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
46    html_root_url = "https://docs.rs/crypto-hashes/0.10.0"
47)]
48#![warn(missing_docs, rust_2018_idioms)]
49
50pub use blake2;
51#[cfg(feature = "include_weak")]
52pub use gost94;
53pub use groestl;
54#[cfg(feature = "include_weak")]
55pub use md2;
56#[cfg(feature = "include_weak")]
57pub use md4;
58#[cfg(feature = "include_weak")]
59pub use md5;
60pub use ripemd;
61#[cfg(feature = "include_weak")]
62pub use sha1;
63pub use sha2;
64pub use sha3;
65#[cfg(feature = "include_weak")]
66pub use streebog;
67pub use whirlpool;
68
69pub use digest;