PDFium Delphi Component Docs

FPdfSha512 unit

Unit: FPdfSha512
Pure-Pascal SHA-512 and SHA-384 implementation sharing one context type, with incremental init/update/final and one-shot byte-array helpers

Syntax

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;

Description

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

Functions

FunctionDescription
Sha512InitInitialises a SHA-512 context
Sha384InitInitialises a SHA-384 context (sets the internal Is384 flag)
Sha512UpdateFeeds an untyped buffer into an open SHA-512 or SHA-384 context
Sha512FinalFinalises a SHA-512 context and returns the 64-byte digest
Sha384FinalFinalises a SHA-384 context and returns the 48-byte digest
Sha512BytesOne-shot SHA-512 hash of a byte array
Sha384BytesOne-shot SHA-384 hash of a byte array

Types

TypeDescription
TSha512Digest64-byte SHA-512 digest
TSha384Digest48-byte SHA-384 digest
TSha512ContextShared incremental context for SHA-512 and SHA-384

Remarks

See Also

FPdfSha256