yomorun / hashids-java

Hashids algorithm v1.0.0 implementation in Java
http://hashids.org
MIT License
1.02k stars 156 forks source link

diffrent results in python and java with same alphabet and salt #48

Closed syncml closed 7 years ago

syncml commented 7 years ago

Python(2.7 hashids version=1.0.2):

from hashids import Hashids hashids = Hashids(salt='this is my salt',alphabet='0123456789abcdefghijklmnopqrstuvwx') print hashids.encode(654321) # print gr9gdg

java (hashids version=1.0.2):

Hashids hashids = new Hashids("this is my salt", 0, "0123456789abcdefghijklmnopqrstuvwx"); System.out.println(hashids.encode(654321)); # print wwp5p6

if alphabet='0123456789abcdefghijklmnopqrstuvwxyz', the result is nice.

It's a bug?

0x3333 commented 7 years ago

The correct response is gr9gdg, testing using your parameters, I got gr9gdg correctly.

How did you get wwp5p6?

screen shot 2017-07-11 at 11 14 52

syncml commented 7 years ago

Sorry. Sorry.Sorry.

My java app running the test case use the 1.0.1 version rather than 1.0.2 :( ,so it got incorrect response. 1.0.1 response is wwp5p6 1.0.2 response is gr9gdg

0x3333 commented 7 years ago

Just to inform a new version has been issued! 1.0.3.