Package zeroecho.core.alg.digest
package zeroecho.core.alg.digest
Digest algorithms (SHA-2, SHA-3, SHAKE) and their streaming contexts.
This package provides the core unkeyed hash functions of the ZeroEcho
library. It integrates JCA MessageDigest engines into
the frameworkâs streaming context model, allowing digests to be applied as
pipeline stages with produce/verify modes. It also defines immutable
specifications for selecting digest variants and output lengths for
extendable-output functions.
Scope and responsibilities
- Expose a single algorithm descriptor under id
"DIGEST"that covers SHA-2, SHA-3, and SHAKE variants. - Provide a JCA-backed
DigestContextfor streaming input through aMessageDigestengine. - Support both fixed-length digests and extendable-output functions (XOFs) with configurable output size.
- Ensure interoperability with JCA provider implementations.
Components
- Sha2Sha3Algorithm: registers the algorithm, declares its digest
capability, and creates contexts bound to the appropriate JCA
MessageDigest. - DigestSpec: immutable specification of digest variant and output length (for XOFs); provides static factories for common cases.
- JcaDigestContext: streaming digest context that adapts
MessageDigestto the core SPI, supporting produce (append digest) and verify (check expected tag) modes.
Design notes
- Algorithm instances are immutable and thread-safe for reuse.
- Context instances are stateful and not thread-safe; create a new context for each pipeline.
- Verification policies integrate with the tagging engine to either throw on mismatch or set a flag in the context.
- Extendable-output functions require explicit output lengths; fixed digests derive their size from the algorithm.
- Since:
- 1.0
-
ClassDescriptionDigest parameters for SHA-2, SHA-3, and SHAKEEnumeration of supported digest algorithms.Digest context that adapts a JCA
MessageDigestto a pull-based streaming pipeline.SHA-2, SHA-3, and SHAKE digest algorithms