DB2 Scalar functions - HASH4
The HASH4 function returns the 32-bit checksum hash of the input data. The function provides 232 distinct return values and is intended for data retrieval (lookups).
The schema is SYSIBM.
The algorithm value can be either 0 or 1. 0 is the default value and indicates the Adler algorithm. 1 indicates the CRC32 algorithm. The Adler algorithm provides a faster checksum hash; however, it has poor coverage when the messages are less than a few hundred bytes (poor coverage means that two different integers hash to the same value, referred to as a collision). In this case, use the CRC32 algorithm, or switch to hash8 instead.
The data type of the result is INTEGER. If the first argument can be null, the result can be null. If the first argument is null, the result is the null value.
The following example gives a hashed value of a string of text:
values hash4('Charlie at IBM', 0) The result is 622396582