#blake2s #blake2 #blake2sp

blake2s_simd

a pure Rust BLAKE2s implementation with dynamic SIMD

11 releases

0.5.11 Nov 2, 2020
0.5.10 Jan 5, 2020
0.5.9 Nov 6, 2019
0.5.8 Sep 5, 2019
0.5.1 May 21, 2019

#8 in Hardware support

Download history 10795/week @ 2020-08-13 11294/week @ 2020-08-20 9707/week @ 2020-08-27 9790/week @ 2020-09-03 11638/week @ 2020-09-10 13613/week @ 2020-09-17 11950/week @ 2020-09-24 11074/week @ 2020-10-01 12190/week @ 2020-10-08 12820/week @ 2020-10-15 17234/week @ 2020-10-22 13306/week @ 2020-10-29 14431/week @ 2020-11-05 15163/week @ 2020-11-12 17204/week @ 2020-11-19 11468/week @ 2020-11-26

51,520 downloads per month
Used in 139 crates (17 directly)

MIT license

145KB
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

~87KB