Skip to main content

Crate lib_q_keccak_digest

Crate lib_q_keccak_digest 

Source
Expand description

Pre–FIPS Keccak fixed digests: original Keccak padding, not FIPS 202 SHA-3 (use lib_q_sha3 for Sha3_256 and the SHA-3 family).

§Types

§Security

  • Keccak256 and any lib_q_sha3::Sha3_256 produce different digests for the same input (different padding).
  • Do not substitute this crate for SHA-3 in a protocol without explicit specification.

See the crate README for links, architecture ADR, and follow-up dependency extraction ADR.

§lib-q-keccak-digest

Pre–FIPS Keccak fixed-length digests for lib-Q: Keccak224Keccak512 and the non-standard Keccak256Full (200-byte output, CryptoNight-style width). This is not FIPS 202 SHA-3—different padding from lib-q-sha3 (Sha3_256, SHAKE, cSHAKE, TurboSHAKE).

§Security

  • Keccak256 and Sha3_256 are different functions (different padding). Do not swap them in a protocol.
  • Keccak256Full is a 200-byte digest width, not a 32-byte “Keccak-256” hash. Do not treat it like Sha3_256 or Keccak256.
  • This crate is for interoperability with legacy or non-NIST uses of the Keccak sponge with original padding; for new NIST-aligned designs, use SHA-3 and related types from lib-q-sha3.

§no_std, alloc, and WebAssembly

The crate is #![no_std]. Default features include alloc (via the digest feature) for the usual buffer_fixed! hasher API. The dependency on lib-q-sha3 uses default-features = false so the Keccak permutation does not pull std (for example for thumb* or wasm32-unknown-unknown).

CI cross-checks wasm32-unknown-unknown and thumbv7em-none-eabi for this package. For wasm32-unknown-unknown, match the workspace pattern for getrandom if your binary links crates that use it: set CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS to include --cfg getrandom_backend="wasm_js" (see the k12-no-std-wasm job in .github/workflows/ci.yml).

§License

Apache-2.0; see the workspace LICENSE file.

§Architecture

Non–FIPS-202 digests are isolated here; rationale is ADR 001 in lib-q-sha3. A future slimmer dependency graph (without a full lib-q-sha3 line for every use case) is ADR 002.

Structs§

Keccak224
Keccak-224 (original Keccak padding, not SHA3-224).
Keccak256
Keccak-256 (original Keccak padding, not SHA3-256).
Keccak384
Keccak-384 (original Keccak padding, not SHA3-384).
Keccak512
Keccak-512 (original Keccak padding, not SHA3-512).
Keccak256Full
Non-standard 200-byte output Keccak-256 (e.g. CryptoNight-style). Not FIPS SHA3-256—see the crate README.

Traits§

Digest
Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.

Functions§

keccak_224
One-shot Keccak-224 (original padding; not SHA-3-224).
keccak_256
One-shot Keccak-256 (original padding; not SHA-3-256).
keccak_384
One-shot Keccak-384 (original padding; not SHA-3-384).
keccak_512
One-shot Keccak-512 (original padding; not SHA-3-512).
keccak_256_full
One-shot Keccak256Full (200-byte output, original padding).