Skip to main content

Crate oxicrypto_hash

Crate oxicrypto_hash 

Source
Expand description

Pure Rust hash function implementations for the OxiCrypto stack.

Provides Hash-trait wrappers and StreamingHash adapters for:

  • SHA-2: SHA-256, SHA-384, SHA-512, SHA-512/256 (FIPS 180-4)
  • SHA-3: SHA3-256, SHA3-384, SHA3-512 (FIPS 202)
  • BLAKE2: BLAKE2b-256, BLAKE2b-512, BLAKE2s-256 (RFC 7693)
  • BLAKE3: standard, keyed-hash, key-derivation, XOF (blake3 spec)
  • SHAKE128/256, cSHAKE128/256, TupleHash128/256 (NIST SP 800-185)
  • BLAKE2b keyed-hash mode (RFC 7693 MAC mode)

All streaming adapters implement StreamingHash via the generic DigestStreamingAdapter wrapper which works with any digest::Digest + Default type.

Structs§

Blake3
BLAKE3 hash function (32-byte output by default).
Blake2b256
BLAKE2b-256 hash function (32-byte output, RFC 7693).
Blake2b512
BLAKE2b-512 hash function (64-byte output, RFC 7693).
Blake2bKeyed
BLAKE2b keyed-hash (MAC mode), with variable output size 1–64 bytes.
Blake2s256
BLAKE2s-256 hash function (32-byte output, RFC 7693).
Blake3Keyed
BLAKE3 keyed-hash (MAC-like): deterministic 32-byte output under a 32-byte key.
Blake3Streaming
Streaming BLAKE3 hasher (32-byte output).
DigestStreamingAdapter
Generic streaming adapter wrapping any digest::Digest + Default type.
HashBuilder
Fluent builder producing a boxed one-shot Hash instance.
ParallelHash128
ParallelHash128 configured with a block size and customization string.
ParallelHash256
ParallelHash256 configured with a block size and customization string.
Sha3_256
SHA3-256 hash function (32-byte output, FIPS 202).
Sha3_384
SHA3-384 hash function (48-byte output, FIPS 202).
Sha3_512
SHA3-512 hash function (64-byte output, FIPS 202).
Sha256
SHA-256 hash function (32-byte output, FIPS 180-4 §6.2).
Sha384
SHA-384 hash function (48-byte output, FIPS 180-4 §6.5).
Sha512
SHA-512 hash function (64-byte output, FIPS 180-4 §6.4).
Sha512_256
SHA-512/256 truncated hash function (32-byte output, FIPS 180-4 §6.7).
Shake128Reader
SHAKE128 XOF reader: stream an arbitrary number of output bytes from a finalised SHAKE128 state.
Shake256Reader
SHAKE256 XOF reader: stream an arbitrary number of output bytes from a finalised SHAKE256 state.
StreamingHashBuilder
Fluent builder producing a DynStreamingHash instance.

Enums§

DynStreamingHash
Runtime-dispatched streaming hasher returned by StreamingHashBuilder::build.
HashAlgorithm
Hash algorithm selector used by HashBuilder.

Functions§

blake2b_keyed
Hash msg under key with BLAKE2b in keyed mode; output is written to out.
blake3_derive_key
Derive a 32-byte key using BLAKE3 key-derivation mode.
blake3_keyed_hash
Hash msg under key with BLAKE3 keyed-hash mode; returns 32 bytes.
blake3_xof
Hash msg with BLAKE3 and return output_len bytes.
cshake128
Hash msg with cSHAKE128 (NIST SP 800-185 §3) and fill out.
cshake256
Hash msg with cSHAKE256 (NIST SP 800-185 §3) and fill out.
parallel_hash128
ParallelHash128 with fixed output length (NIST SP 800-185 §6.1).
parallel_hash256
ParallelHash256 with fixed output length (NIST SP 800-185 §6.2).
parallel_hash128_xof
ParallelHash128 in extendable-output (XOF) mode (NIST SP 800-185 §6.3).
parallel_hash256_xof
ParallelHash256 in extendable-output (XOF) mode (NIST SP 800-185 §6.3).
shake128
Hash msg with SHAKE128 and fill out with extendable output.
shake256
Hash msg with SHAKE256 and fill out with extendable output.
shake128_start
Begin a SHAKE128 computation, returning a finalisable hasher.
shake256_start
Begin a SHAKE256 computation, returning a finalisable hasher.
tuple_hash128
TupleHash128 (NIST SP 800-185 §5).
tuple_hash256
TupleHash256 (NIST SP 800-185 §5).

Type Aliases§

Blake2b256Streaming
Streaming BLAKE2b-256 hasher (32-byte output).
Blake2b512Streaming
Streaming BLAKE2b-512 hasher (64-byte output).
Blake2s256Streaming
Streaming BLAKE2s-256 hasher (32-byte output).
Sha3_256Streaming
Streaming SHA3-256 hasher.
Sha3_384Streaming
Streaming SHA3-384 hasher.
Sha3_512Streaming
Streaming SHA3-512 hasher.
Sha256Streaming
Streaming SHA-256 hasher.
Sha384Streaming
Streaming SHA-384 hasher.
Sha512Streaming
Streaming SHA-512 hasher.
Sha512_256Streaming
Streaming SHA-512/256 hasher.