Closed patrickfav closed 5 years ago
This is to be compatible with the original implementation.
Read Limitations on Readme.md, https://github.com/10cella/hashids-java#limitations
Ah I see, thanks. Maybe adapt the readme, because 'decodable hashes from unsigned (long) integers' is very misleading as it does not mean unsigned in the primitive type sense, but just that negative numbers are not allowed, it actually uses signed longs.
Feel free to create a PR, would help. Thanks!
The doc says:
but then it says
And the implementation caps the max number to 2^53 (0-9,007,199,254,740,992)
https://github.com/10cella/hashids-java/blob/162a263c8007652472bf1821a26d33190730f8a5/src/main/java/org/hashids/Hashids.java#L24
0 - 18,446,744,073,709,551,616
(1.8x10^19)0 - 9,223,372,036,854,775,807
(9.2x10^18)You currently support 53 bit long integers - I can only assume that is a bug? Java's primitives are always signed, so you have about 2^63 values in the plus and minus range. The most logical range would be 2^63 if you only want to support from 0 up and not make the caller convert to unsigned longs?