vinkla/hashids

digits as custom alphabet

HamidMp opened this issue · 1 comments

What if we want to use the numbers (0-9) as the custom alphabet? Encounters an error

You can use hexadecimal alphabet 0123456789abcdef and then use hexdec() function (https://www.php.net/manual/en/function.hexdec.php) to convert HEX to DEC. And back in the same way. The downside of this approach is that you won't be able to adjust the hash length. Some hashes will be longer than the specified limit.