Duplicate Checksum

I was using checksum() to perform a reconciliation task and found that for a decimal number, the positive and the negative value will produce the same checksum.

image

Even though I knew that checksum() is not perfect for checking differences, but I was still quite surprised to find how easy it is to produce duplicate checksums.

The following table lists some of my observations.

Expression Checksum
checksum(1)
checksum(-1)
1
-1
binary_checksum(1)
binary_checksum(-1)
1
-1
checksum(1.0)
checksum(-1.0)
-1374215283
-1374215283
binary_checksum(1.0)
binary_checksum(-1.0)
-1374215283
-1374215283
checksum(‘1’)
checksum(‘-1’)
65
65
binary_checksum(‘1’)
binary_checksum(‘-1’)
49
737
checksum(‘1.0’)
checksum(‘-1.0’)
-1043840145
-1043840145
binary_checksum(‘1.0’)
binary_checksum(‘-1.0’)
13264
189392

Looking at the table above, I think I will stop using checksum() in the future.