vinkla / hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
https://hashids.org/php
MIT License
5.28k stars 418 forks source link

2 particulars numbers render the exact same result whatever the salt used ???!!! #180

Closed sdespont closed 2 years ago

sdespont commented 2 years ago

I have a big problem understanding why these 2 particulars numbers render the exact same result whatever the salt used ???!!!

        $hashids = new Hashids('any kind of salt', 10);
        $a = $hashids->encode(44888);
        $b = $hashids->encode(44900);

Result with this salt for both numbers : egjagwwPBd

It is always the same result. Is there anyone able to explain why?

I am using PHP 8.0.20 BTW

sdespont commented 2 years ago

Really sorry, the numbers are very similar, but different with a letter as lower case.... and my MYSQL database has been set as "case insensitive"