#blake2s #parallel-processing #blake2sp

no-std blake2s_simd

a pure Rust BLAKE2s implementation with dynamic SIMD

14 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.5.5 Jul 22, 2019

#16 in Concurrency

Download history 109993/week @ 2024-07-23 121785/week @ 2024-07-30 105852/week @ 2024-08-06 121970/week @ 2024-08-13 127815/week @ 2024-08-20 95980/week @ 2024-08-27 111455/week @ 2024-09-03 111577/week @ 2024-09-10 122962/week @ 2024-09-17 133162/week @ 2024-09-24 144610/week @ 2024-10-01 143388/week @ 2024-10-08 151059/week @ 2024-10-15 148481/week @ 2024-10-22 144871/week @ 2024-10-29 147738/week @ 2024-11-05

615,102 downloads per month
Used in 277 crates (33 directly)

MIT license

150KB
3K SLoC

blake2s_simd GitHub crates.io Actions Status

An implementation of the BLAKE2s and BLAKE2sp hash functions. See also blake2b_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 BLAKE2s hashes in parallel, matching the efficiency of BLAKE2sp. See the many module.

Example

use blake2s_simd::{blake2s, Params};

let expected = "08d6cad88075de8f192db097573d0e829411cd91eb6ec65e8fc16c017edfdb74";
let hash = blake2s(b"foo");
assert_eq!(expected, &hash.to_hex());

let hash = Params::new()
    .hash_length(16)
    .key(b"Squeamish Ossifrage")
    .personal(b"Shaftoe")
    .to_state()
    .update(b"foo")
    .update(b"bar")
    .update(b"baz")
    .finalize();
assert_eq!("28325512782cbf5019424fa65da9a6c7", &hash.to_hex());

Dependencies

~105KB