Search code examples
javapostgresqlchecksum

Suitable checksum for uniquely identifying a series of numbers in Postgres 9 and Java


Given a series of numbers (generally less than 20 numbers with values between 100 & 1000 but not necessarily)

e.g 100, 343, 234, 123, 456, 345, 80, 99, 100

what is a good checksum such as to minimize the risk of a different series of different numbers, (different order is an important as different numbers) giving the same checksum.

Looking for a checksum that is available in PostgreSQL 9 and Java


Solution

  • I would suggest converting to a delimited string and then use MD5() in Postgres and java.security.MessageDigest / getInstance("MD5") in Java.