#blake2b #simd #blake2 #dynamic

blake2b_simd

a pure Rust BLAKE2b implementation with dynamic SIMD

14 unstable releases (4 breaking)

✓ Uses Rust 2018 edition

new 0.5.2 Jun 14, 2019
0.5.1 May 21, 2019
0.4.1 Oct 26, 2018
0.3.1 Oct 14, 2018
0.1.0 Aug 12, 2018
Download history 273/week @ 2019-03-01 384/week @ 2019-03-08 294/week @ 2019-03-15 393/week @ 2019-03-22 366/week @ 2019-03-29 417/week @ 2019-04-05 722/week @ 2019-04-12 509/week @ 2019-04-19 463/week @ 2019-04-26 551/week @ 2019-05-03 612/week @ 2019-05-10 1095/week @ 2019-05-17 1011/week @ 2019-05-24 1105/week @ 2019-05-31 901/week @ 2019-06-07

2,846 downloads per month
Used in 24 crates (10 directly)

MIT license

142KB
3K SLoC

blake2b_simd GitHub crates.io Build Status

An implementation of the BLAKE2b and BLAKE2bp hash functions. See also blake2s_simd.

This crate includes:

  • 100% stable Rust.
  • SIMD implementations based on Samuel Neves' blake2-avx2. These are very fast. For benchmarks, see the Performance section of the README.
  • Portable, safe implementations for other platforms.
  • Dynamic CPU feature detection. Binaries include multiple implementations by default and choose the fastest one the processor supports at runtime.
  • All the features from the the BLAKE2 spec, like adjustable length, keying, and associated data for tree hashing.
  • no_std support. The std Cargo feature is on by default, for CPU feature detection and for implementing std::io::Write.
  • Support for computing multiple BLAKE2b hashes in parallel, matching the efficiency of BLAKE2bp. See the many module.

Example

use blake2b_simd::{blake2b, Params};

let expected = "ca002330e69d3e6b84a46a56a6533fd79d51d97a3bb7cad6c2ff43b354185d6d\
                c1e723fb3db4ae0737e120378424c714bb982d9dc5bbd7a0ab318240ddd18f8d";
let hash = blake2b(b"foo");
assert_eq!(expected, &hash.to_hex());

let hash = Params::new()
    .hash_length(16)
    .key(b"The Magic Words are Squeamish Ossifrage")
    .personal(b"L. P. Waterhouse")
    .to_state()
    .update(b"foo")
    .update(b"bar")
    .update(b"baz")
    .finalize();
assert_eq!("ee8ff4e9be887297cf79348dc35dab56", &hash.to_hex());

Dependencies

~85KB