YOUSEFUL / DELPHI / COMPONENTS
TAtlasHashKind
The hash algorithms: SHA-256, SHA-384 and SHA-512, and the legacy SHA-1 and MD5.
Description
Used by TAtlasHash, TAtlasKdf and TAtlasHashCalculator. The constant array AtlasHashNames in Atlas.Crypto holds the CNG algorithm name of each value (SHA256, SHA384, SHA512, SHA1, MD5), and TAtlasHash.DigestSize its digest length. hkSHA1 and hkMD5 are broken for security purposes; they exist for checksums published with them and for old systems, never for signatures or passwords.
Members
| Member | Kind | What it does |
|---|---|---|
hkSHA256 | value | SHA-256, 32-byte digest. |
hkSHA384 | value | SHA-384, 48-byte digest. |
hkSHA512 | value | SHA-512, 64-byte digest. |
hkSHA1 | value | SHA-1, 20-byte digest. |
hkMD5 | value | MD5, 16-byte digest. |
Values
hkSHA256 value
hkSHA256SHA-256, 32-byte digest. The default everywhere a hash can be chosen.
hkSHA384 value
hkSHA384SHA-384, 48-byte digest.
hkSHA512 value
hkSHA512SHA-512, 64-byte digest.
hkSHA1 value
hkSHA1SHA-1, 20-byte digest. Legacy: for checksums and old systems only.
hkMD5 value
hkMD5MD5, 16-byte digest. Legacy: for checksums and old systems only.
Examples
List the algorithms and their digest sizes
Prints SHA256: 32 bytes, SHA384: 48 bytes, SHA512: 64 bytes, SHA1: 20 bytes and MD5: 16 bytes.
uses System.SysUtils, Atlas.Crypto;
procedure ListDigestSizes;
var
Kind: TAtlasHashKind;
begin
for Kind := Low(TAtlasHashKind) to High(TAtlasHashKind) do
WriteLn(AtlasHashNames[Kind], ': ', TAtlasHash.DigestSize(Kind), ' bytes');
end;
Related
TAtlasHash · TAtlasKdf · TAtlasHashCalculator