TSHA256Digest = array[0..31] of Byte;
TSHA256Context = record
State: array[0..7] of Cardinal;
Buffer: array[0..63] of Byte;
BufCnt: Cardinal;
Length: UInt64;
end;
procedure SHA256Init(out Ctx: TSHA256Context);
procedure SHA256Update(var Ctx: TSHA256Context; const Buf; BufLen: Cardinal);
procedure SHA256Final(var Ctx: TSHA256Context; out Digest: TSHA256Digest);
function SHA256Bytes(const B: TBytes): TSHA256Digest;
function SHA256Of(const Buf; BufLen: Cardinal): TSHA256Digest;
function SHA256Hex(const Digest: TSHA256Digest): string;
FPdfSha256 er den SHA-256-hash-implementering, der bruges i hele PDFium Delphi Component-signerings- og krypteringsstakken. Den kræves, fordi Free Pascal ikke leverer en SHA-2-enhed, og ved at medtage den holdes biblioteket afhængighedsfrit på alle understøttede compilere
Det inkrementelle SHA256Init / SHA256Update / SHA256Final-API hasher data større end hukommelsen eller streamet i chunks. SHA256Bytes og SHA256Of er one-shot-helpers over et byte-array eller en utypet buffer, og SHA256Hex formaterer et digest som en lowercase 64-tegn-hex-streng
Typen TSHA256Digest forbruges af FPdfCms, FPdfTsa og FPdfCryptoWin som digest-formen til signed-attribute-hashing
| Function | Description |
|---|---|
SHA256Init | Initializes a hashing context |
SHA256Update | Feeds an untyped buffer into an open context |
SHA256Final | Finalizes the context and returns the 32-byte digest |
SHA256Bytes | One-shot hash of a byte array |
SHA256Of | One-shot hash of an untyped buffer of a given length |
SHA256Hex | Formats a digest as a lowercase hex string |
| Type | Description |
|---|---|
TSHA256Digest | 32-byte SHA-256 digest consumed by the CMS, TSA, and crypto units |
TSHA256Context | Incremental hashing context holding the working state, message block buffer, byte count, and total length |