Skip to main content

Crate shake

Crate shake 

Source
Expand description

§RustCrypto: SHAKE

crate Docs Apache2/MIT licensed Rust Version Project Chat Build Status

Implementation of the SHAKE family of extendable-output functions (XOFs) defined in NIST FIPS 202.

§Examples

SHAKE functions have an extendable output, so finalization methods return XOF reader from which results of arbitrary length can be read.

use shake::Shake128;
use shake::digest::{Update, ExtendableOutput, XofReader};
use hex_literal::hex;

let mut hasher = Shake128::default();
hasher.update(b"abc");
let mut reader = hasher.finalize_xof();
let mut buf = [0u8; 10];
reader.read(&mut buf);
assert_eq!(buf, hex!("5881092dd818bf5cf8a3"));
reader.read(&mut buf);
assert_eq!(buf, hex!("ddb793fbcba74097d5c5"));

See the digest crate docs for additional examples.

§License

The crate is licensed under either of:

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Re-exports§

pub use digest;

Structs§

Shake
SHAKE hasher generic over rate.
ShakeReader
SHAKE XOF reader generic over rate.

Traits§

ExtendableOutput
Trait for hash functions with extendable-output (XOF).
Update
Types which consume data with byte granularity.
XofReader
Trait for reader types which are used to extract extendable output from a XOF (extendable-output function) result.

Type Aliases§

Shake128
SHAKE128 hasher.
Shake256
SHAKE256 hasher.
Shake128Reader
SHAKE128 XOF reader.
Shake256Reader
SHAKE256 XOF reader.