Just wanted do add: don't use MD5 if nobody else had already mentioned it.
Of course MD5 was only being used as a simplistic example - most likely the hash function would be SHA256 or similar (but we will have to consider whether to use 256 bits or less as that will eat up precious data bytes).