TSha3Algorithm = (s3aSha3_256, s3aSha3_384, s3aSha3_512, s3aShake256);
TSha3Digest256 = array[0..31] of Byte;
TSha3Digest384 = array[0..47] of Byte;
TSha3Digest512 = array[0..63] of Byte;
TSha3Context = record
State: array[0..24] of UInt64;
Buffer: array[0..135] of Byte;
BufferLength: Integer;
Rate: Integer;
SqueezeOffset: Integer;
Algorithm: TSha3Algorithm;
Finalized: Boolean;
end;
procedure Sha3_256Init(out Ctx: TSha3Context);
procedure Sha3_384Init(out Ctx: TSha3Context);
procedure Sha3_512Init(out Ctx: TSha3Context);
procedure Shake256Init(out Ctx: TSha3Context);
procedure Sha3Update(var Ctx: TSha3Context; const Data; DataLength: Integer);
procedure Sha3_256Final(var Ctx: TSha3Context; out Digest: TSha3Digest256);
procedure Sha3_384Final(var Ctx: TSha3Context; out Digest: TSha3Digest384);
procedure Sha3_512Final(var Ctx: TSha3Context; out Digest: TSha3Digest512);
procedure Shake256Final(var Ctx: TSha3Context);
procedure Shake256Squeeze(var Ctx: TSha3Context; out Output; OutputLength: Integer);
function Shake256Bytes(const Data: TBytes; OutputLength: Integer): TBytes;
FPdfSha3 implements the FIPS 202 SHA-3 family needed by ISO/TS 32001 and related PDF 2.x cryptographic extensions without requiring an operating-system crypto provider
Fixed-output hashes share one context type and algorithm-checked finalizers, while SHAKE256 separates final absorption from output so callers can request any length across one or more Shake256Squeeze calls
| Function | Description |
|---|---|
Sha3_256Init, Sha3_384Init, Sha3_512Init | Initialize a fixed-output SHA-3 context |
Shake256Init | Initializes a SHAKE256 extendable-output context |
Sha3Update | Absorbs an untyped input buffer into any initialized context |
Sha3_256Final, Sha3_384Final, Sha3_512Final | Finalize a matching context and return its fixed-length digest |
Shake256Final | Finalizes SHAKE256 absorption without consuming output |
Shake256Squeeze | Continues SHAKE256 output from the current offset across repeated calls |
Sha3_256Bytes, Sha3_384Bytes, Sha3_512Bytes | Hash a byte array in one call |
Shake256Bytes | Returns a caller-selected number of SHAKE256 output bytes |
Sha3_256Hex, Sha3_384Hex, Sha3_512Hex | Convert a fixed digest to lowercase hexadecimal text |
| Type | Description |
|---|---|
TSha3Algorithm | Selects the algorithm configured into a context: s3aSha3_256, s3aSha3_384, and s3aSha3_512 choose a fixed-output SHA-3 hash with its digest size, while s3aShake256 chooses the extendable-output function |
TSha3Digest256, TSha3Digest384, TSha3Digest512 | Fixed-size digest buffers |
TSha3Context | Incremental sponge state, rate buffer, algorithm, and squeeze offset |
ESha3Error | Reports invalid lengths, lifecycle misuse, or mismatched finalizers |
| Field | Description |
|---|---|
State | The 1600-bit Keccak-f[1600] sponge state as 25 64-bit lanes; absorbed bytes are XORed into the leading lanes and squeezed output bytes are read back out of them |
Buffer | Staging area for input bytes that have not yet filled a complete rate block; 136 entries cover the largest supported rate |
BufferLength | Number of input bytes currently staged in Buffer |
Rate | Sponge rate in bytes, fixed by the initializer: 136 for s3aSha3_256 and s3aShake256, 104 for s3aSha3_384, and 72 for s3aSha3_512 |
SqueezeOffset | Read position inside the current squeeze block; once it reaches Rate the next Keccak-f[1600] permutation produces a fresh output block |
Algorithm | The TSha3Algorithm value the context was configured with; finalizers verify it matches before emitting output |
Finalized | Set once domain padding has been absorbed; further Sha3Update calls on a finalized context raise ESha3Error |
Sha3Update and use only the corresponding fixed-output finalizerShake256Final, repeated Shake256Squeeze calls continue the same output stream rather than restarting itESha3Error