YOUSEFUL / DELPHI / COMPONENTS

TAtlasHashKind

The hash algorithms: SHA-256, SHA-384 and SHA-512, and the legacy SHA-1 and MD5.

Enumeration Unit Atlas.Crypto · Product Atlas Crypto

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

MemberKindWhat it does
hkSHA256valueSHA-256, 32-byte digest.
hkSHA384valueSHA-384, 48-byte digest.
hkSHA512valueSHA-512, 64-byte digest.
hkSHA1valueSHA-1, 20-byte digest.
hkMD5valueMD5, 16-byte digest.

Values

hkSHA256 value

hkSHA256

SHA-256, 32-byte digest. The default everywhere a hash can be chosen.

hkSHA384 value

hkSHA384

SHA-384, 48-byte digest.

hkSHA512 value

hkSHA512

SHA-512, 64-byte digest.

hkSHA1 value

hkSHA1

SHA-1, 20-byte digest. Legacy: for checksums and old systems only.

hkMD5 value

hkMD5

MD5, 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.

pascal
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;

TAtlasHash · TAtlasKdf · TAtlasHashCalculator

Also in Atlas Crypto

TAtlasHashCalculator · TAtlasFileProtector