rokdocs
v0.1

rok::core::crypto::sha2

SHA-2 (FIPS 180-4): SHA-256, SHA-384 and SHA-512, chosen by HashAlgorithm; Digest is a running hash.

Structs

Digest

pub struct Digest

A running hash of a HashAlgorithm. A value: copying it forks the running hash (a transcript hash read mid-way).

  • pub const fn new(alg: HashAlgorithm) -> Digest
  • pub const fn algorithm(self) -> HashAlgorithm
  • pub fn update(ref self, data: Bytes)
  • pub const fn finish(self) -> List<u8>

Enums

HashAlgorithm

pub enum HashAlgorithm

A SHA-2 function chosen at run time (HMAC, HKDF, signatures, TLS).

  • Sha256
  • Sha384
  • Sha512
  • pub const fn output_len(self) -> usize
  • pub const fn block_len(self) -> usize
  • pub fn digest(self, data: Bytes) -> List<u8>