CHECKMD5: Computing an MD5 Hash Check Value

CHECKMD5 takes an alphanumeric input value and returns a 128-bit value in a fixed-length alphanumeric string, using the MD5 hash function. A hash function is any function that can be used to map data of arbitrary size to data of fixed size. The values returned by a hash function are called hash values. They can be used for assuring the integrity of transmitted data.

Compute an MD5 Hash Check Value

CHECKMD5(buffer)

where:

buffer

Is a data buffer whose hash value is to be calculated. It can be a set of data of different types presented as a single field, or a group field in one of the following data type formats: An, AnV, or TXn.

Calculating an MD5 Hash Check Value

The following request calculates an MD5 hash check value and converts it to an alphanumeric hexadecimal value for display.

DEFINE FILE WF_RETAIL_LITE
MD5/A32 = HEXTYPE(CHECKMD5(PRODUCT_CATEGORY));
END
TABLE FILE WF_RETAIL_LITE
SUM MD5 
BY PRODUCT_CATEGORY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,FONT=COURIER,$
 ENDSTYLE
END

The output is shown in the following image. The monospaced font shows that although the input values have varying length, the output has a fixed length.

CHECKMD5 calculates a fixed length MD5 hash check value, and HEXTYPE converts it to a printable hexadecimal string.

HEXTYPE(CHECKMD5(PRODUCT_CATEGORY))

For Accessories, the result is 98EDB85B00D9527AD5ACEBE451B3FAE6.