Icon ComputeHash

Unit: WebCore

Available In: Server Applications

function ComputeHash(HashType: THashType;
                     const Value: String): String

The ComputeHash function computes a cryptographic hash for the string input parameter. The hash type parameter determines the type of computed hash that is returned, and can be one of the following values:

Hash TypeDescription
htMD5Specifies that the computed hash will be a 128-bit MD-5 (Message Digest) hash.
Warning MD-5 hashes are cryptographic hashes, but are not secure and should only be used for purposes such as computing checksums for data.
htSHA1Specifies that the computed hash will be a 160-bit SHA-1 (Secure Hash Algorithm) hash.
Warning SHA-1 hashes are cryptographic hashes, but are not secure and should only be used for purposes such as computing checksums for data.
htSHA256Specifies that the computed hash will be a 256-bit SHA-2 (Secure Hash Algorithm) hash.
htSHA512Specifies that the computed hash will be a 512-bit SHA-2 (Secure Hash Algorithm) hash.

Information The THashType enumerated type is declared in the WebSrvr unit.

The return value is a hexadecimal String value containing the computed hash.

Examples

X := ComputeHash(htSHA256,'Hello World');  // X is '979AB6536128EE79BCBB8D0386F29429D09B706B5CA77BFA5497968187E304C3'
Image