Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Unique IDs for sorting images

Name: Anonymous 2009-09-14 3:51

I've got a problem. I been using MD5 hash as the name for images, but it's too damn long. What would you guys suggest as a shorter alternative solution?

Name: Anonymous 2009-09-14 14:52

If you used a base64 representation of the hash instead of hexadecimal, it would only be 22 characters instead of 32. Still pretty long, though.

In your case, you only want the IDs to be unique, so you can just use an incrementing counter. (MD5's only benefit here¹ is that it produces IDs which aren't sequential, which you don't need.)

>>17
Birthday paradox.
The birthday problem in this more generic sense applies to hash functions: the expected number of N-bit hashes that can be generated before getting a collision is not 2N, but rather only 2N/2❞.
Yes, you expect a collision after 216 = 65536 items. Enjoy your collisions, Patrick.

_____
¹ Probably. Too lazy to think of any others.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List