#blake2b #blake2 #parallel-processing #blake2bp

no-std blake2b_simd

a pure Rust BLAKE2b implementation with dynamic SIMD

26 releases (3 stable)

1.0.2 Sep 10, 2023
1.0.1 Feb 9, 2023
1.0.0 Nov 19, 2021
0.5.11 Nov 2, 2020
0.4.1 Oct 26, 2018

#5 in Hardware support

Download history 193151/week @ 2024-09-03 191245/week @ 2024-09-10 201574/week @ 2024-09-17 218987/week @ 2024-09-24 231204/week @ 2024-10-01 224064/week @ 2024-10-08 247050/week @ 2024-10-15 235423/week @ 2024-10-22 229097/week @ 2024-10-29 234486/week @ 2024-11-05 220204/week @ 2024-11-12 236435/week @ 2024-11-19 215489/week @ 2024-11-26 268888/week @ 2024-12-03 474869/week @ 2024-12-10 213375/week @ 2024-12-17

1,217,948 downloads per month
Used in 1,377 crates (127 directly)

MIT license

145KB
3K SLoC

blake2b_simd GitHub crates.io Actions 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

~105KB