Chapter 4-8: Runtime Subroutine's and Predefined Processes
.UTIL.COMPUTE.HASH
.UTIL COMPUTE HASH
This subroutine computes the SHA-2 hash value for the given string.
Usage:

Description:
This subroutine computes the SHA-2 hash value for the given string. The first 2 parameters are required and if any required parameters are missing, the subroutine will CANCEL.
<hash value returned> is the computed value returned. This must be passed with Share="Y" to return a value. It should be an alpha field at least 64 or 128 bytes in length, depending on the <hash type> requested (Required).
<hash type> is the type of hash value you want returned (Required):
- BIN for a 64 byte binary value
- UC for a 128 byte readable value, upper case
- LC for a 128 byte readable value, lower case
<Data to hash> is the string to be hashed (32k max size).
<Unicode flag> Pass UNI if you want the calculation performed on a Unicode field (optional, Release 6.0 and higher only). For compatibility with release 5, the hash calculation is performed on a RAW field. PASSing a unicode field in <Data to hash> that contains characters that cannot be transcoded to the RAW encoding will result in a runtime error. To force the calculation to be performed on the Unicode field, pass UNI for <Unicode flag>. Note that since RAW and Unicode fields have different internal structures, passing the same string with and without the <Unicode Flag> will return different hash values.