RustCrypto: SHA-3
Implementation of the TurboSHAKE family of extendable-output functions (XOFs).
Examples
SHAKE functions have an extendable output, so finalization method returns
XOF reader from which results of arbitrary length can be read. Note that
these functions do not implement Digest, so lower-level traits have to
be imported:
use TurboShake128;
use ;
use hex;
// With the default domain separator.
//
// Note that we have to use `<TurboShake128>` because of
// the inadequate handling of defaults in Rust.
// Alternatively, you could use `let mut hasher: TurboShake128 = Default::default();`
// or `TurboShake128::<DEFAULT_DS>::default()`.
let mut hasher = default;
hasher.update;
let mut reader = hasher.finalize_xof;
let mut buf = ;
reader.read;
assert_eq!;
reader.read;
assert_eq!;
// With a custom domain separator
let mut hasher = default;
hasher.update;
let mut reader = hasher.finalize_xof;
let mut buf = ;
reader.read;
assert_eq!;
reader.read;
assert_eq!;
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.