TSha512Digest = array[0..63] of Byte;
TSha384Digest = array[0..47] of Byte;
TSha512Context = record
State: array[0..7] of UInt64;
CountLo: UInt64;
CountHi: UInt64;
Buffer: array[0..127] of Byte;
BufLen: Integer;
Is384: Boolean;
end;
procedure Sha512Init(out Ctx: TSha512Context);
procedure Sha384Init(out Ctx: TSha512Context);
procedure Sha512Update(var Ctx: TSha512Context; const Buf; BufLen: Integer);
procedure Sha512Final(var Ctx: TSha512Context; out Digest: TSha512Digest);
procedure Sha384Final(var Ctx: TSha512Context; out Digest: TSha384Digest);
function Sha512Bytes(const B: TBytes): TSha512Digest;
function Sha384Bytes(const B: TBytes): TSha384Digest;
FPdfSha512 implements the SHA-512 and SHA-384 hash functions over a shared 64-bit-word context. The Is384 flag in the context selects the truncated SHA-384 variant when initialised through Sha384Init
The incremental API mirrors FPdfSha256: initialise a context, feed buffers with Sha512Update, and finalize to a 64-byte SHA-512 digest or a 48-byte SHA-384 digest. Sha512Bytes and Sha384Bytes are one-shot helpers over a byte array
| Function | Description |
|---|---|
Sha512Init | Initialises a SHA-512 context |
Sha384Init | Initialises a SHA-384 context (sets the internal Is384 flag) |
Sha512Update | Feeds an untyped buffer into an open SHA-512 or SHA-384 context |
Sha512Final | Finalises a SHA-512 context and returns the 64-byte digest |
Sha384Final | Finalises a SHA-384 context and returns the 48-byte digest |
Sha512Bytes | One-shot SHA-512 hash of a byte array |
Sha384Bytes | One-shot SHA-384 hash of a byte array |
| Type | Description |
|---|---|
TSha512Digest | 64-byte SHA-512 digest |
TSha384Digest | 48-byte SHA-384 digest |
TSha512Context | Shared incremental context for SHA-512 and SHA-384 |
TSha512Context with the Is384 flag set by Sha384InitSha..., differing from the all-caps SHA256... names in FPdfSha256