# Algorithm that will trim a unique ID number and produce a shorter unique ID

I have a unique ID number with 2^128 magnitude length (128 bits). This means ~3.4e+38 which is quite large that my actually needs, spending valuable time in a transmission protocol.

There is a algorithm that will keep only 2^32 and still guarantees that result is unique?

• Strictly speaking: No. But if you know that these IDs have a certain redundant structure (which is quite likely with this high number of possiblities) or are stored in an inefficient way you can try to compress it with the Compress command. – Henrik Schumacher Jul 4 '17 at 10:56
• If you are generating these unique ID's yourself there are ways to generate shorter hash codes; check the documentation for Hash[] – Daniel W Oct 27 '17 at 13:49
• @DanielW not all hashes offered by Hash are intended to be unique signatures of the input. Generally, only the cryptographic ones are. The others are for applications such as making hash tables, where one only requires a uniform distribution of hash codes among the possible inputs; or for error checking, where one only requires that the hash values for similar inputs differ with very high probability. So, short hashes are not alternatives to the long ones, in any general sense. – Oleksandr R. Oct 27 '17 at 23:22