Crate blake2s_simd[][src]

GitHub crates.io Actions Status

An implementation of the BLAKE2s and BLAKE2sp hash functions. See also blake2b_simd.

This crate includes:

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());

Modules

blake2sp

BLAKE2sp, a variant of BLAKE2s that uses SIMD more efficiently.

many

Interfaces for hashing multiple inputs at once, using SIMD more efficiently.

Structs

Hash

A finalized BLAKE2 hash, with constant-time equality.

Params

A parameter builder that exposes all the non-default BLAKE2 features.

State

An incremental hasher for BLAKE2s.

Constants

BLOCKBYTES

The number input bytes passed to each call to the compression function. Small benchmarks need to use an even multiple of BLOCKBYTES, or else their apparent throughput will be low.

KEYBYTES

The max key length.

OUTBYTES

The max hash length.

PERSONALBYTES

The max personalization length.

SALTBYTES

The max salt length.

Functions

blake2s

Compute the BLAKE2s hash of a slice of bytes all at once, using default parameters.