aws_lc_rs

Module digest

Source
Expand description

SHA-2 and the legacy SHA-1 digest algorithm.

If all the data is available in a single contiguous slice then the digest function should be used. Otherwise, the digest can be calculated in multiple steps using Context.

§Example

use aws_lc_rs::digest;

// Using `digest::digest`
let one_shot = digest::digest(&digest::SHA384, b"hello, world");

// Using `digest::Context`
let mut ctx = digest::Context::new(&digest::SHA384);
ctx.update(b"hello");
ctx.update(b", ");
ctx.update(b"world");
let multi_part = ctx.finish();

assert_eq!(&one_shot.as_ref(), &multi_part.as_ref());

Structs§

  • A digest algorithm.
  • A context for multi-step (Init-Update-Finish) digest calculations.
  • A calculated digest value.

Constants§

Statics§

Functions§

  • Returns the digest of data using the given digest algorithm.