TPLSHA512Digest

Cryptography, digital signatures

Description

TPLSHA512Digest is a fixed array[0..63] of Byte that carries a 64-byte digest by value. SHA512ByteArray and SHA3_512ByteArray return it, and the same width serves the other 64-byte hash consumers in the library.

Element 0 is the first and most significant byte as the hash emits it, so the array can be moved into a DER OCTET STRING or a hexadecimal report unchanged. The width matches the largest digest the CMS profiles and the Ed25519 helper need, which is why one type covers both.

Syntax

Delphi

TPLSHA512Digest = Array [0.. 63] Of Byte;

Remarks

The SHA-3 selector returns the same 64-byte type, so a digest alone does not say whether SHA-512 or SHA3-512 produced it.

SHA512StreamRange hashes the two signed ranges of a revision and returns the bytes as an AnsiString; the fixed array is the form to keep when the value has to outlive a single statement.

Hexadecimal output is the caller's job: iterate the array and format each byte, for example LowerCase(IntToHex(Digest[I], 2)).

There is no := shorthand from the array to a string. Allocate 64 bytes and Move from element 0 when the destination is binary.

The array is copied on assignment and cannot be compared with =; use CompareMem or a byte loop.

SizeOf is 64, so the value is safe to write or read as one block when the destination already knows the width.

See also

SHA512ByteArray, SHA3_512ByteArray, SHA512StreamRange