Closed ivanvermeyen closed 7 years ago
Everything integer lower than 2147483647
will be mapped to a different integer based on your prime number. Collisions within this range are not possible.
I'm looking into making this maximum number configurable so that you can generate smaller or nigger numbers, but no luck yet.
Ok, thanks for the quick reply 👍
I'm looking into making this maximum number configurable so that you can generate smaller or nigger numbers, but no luck yet.
Lol that is a very unfortunate typo
Hi,
I've been looking for a decent, basic explanation about hashing, but it's a bit hard to find. I know that generating random values will always have a chance to return duplicate results. MD5 hashes, for example are also random, but not unique...
My big question is if this also applies to the method of hashing that you use. Will there be even the slightest chance that the resulting hash of value X will be the same as the hash of value Y?
Is there a certain rule behind this idea? Is there a requirement of the amount of possible character combinations used for the resulting hash (like hashids uses a pool of characters instead of just numbers) versus the number of characters in the original value?
Or should I always check the database for duplicates?
I hope someone can shine a light on this for me... :)