Hashes any of several types of source data
using the specified hashing algorithm, and returns a RAW message
digest value whose size and security depends on the algorithm.
Syntax
MESSAGE-DIGEST( hash-algorithm, data-to-hash[ , hash-key] )
|
-
hash-algorithm
- A character string that specifies the hashing algorithm to hash
the data specified by data-to-hash. You can specify
one of the following options, in increasing order of security and
decreasing order of performance:
- "MD5" —
RSA Message Digest Hash Algorithm, which returns a 16-byte RAW binary
message digest value.
- "SHA-1" — United States Government Secure Hash
Algorithm, which returns a RAW 20-byte binary message digest value.
- "SHA-256" — United States Government Secure
Hash Algorithm, which returns a RAW 32-byte binary message digest
value.
- "SHA-512" — United States Government Secure
Hash Algorithm, which returns a RAW 64-byte binary message digest
value.
-
data-to-hash
- The source data to hash. The data may be of type CHARACTER, LONGCHAR,
RAW, or MEMPTR. If the data is a CHARACTER or LONGCHAR value, the
AVM converts it to UTF-8 (which ensures a consistent value regardless
of code page settings). To avoid this automatic conversion, specify
a RAW or MEMPTR value.
-
hash-key
-
An optional key value to use in the hash operation. The key
may be of type CHARACTER, LONGCHAR, RAW, or MEMPTR. If the key is a
CHARACTER or LONGCHAR value, the AVM converts it to UTF-8 (which
ensures a consistent value regardless of code page settings). To avoid
this automatic conversion, specify a RAW or MEMPTR value. This key
value is combined with the source data before the hash operation begins.
If
the hash-key value contains a null character, the
null character is included in the hash operation.