yomorun / hashids-java

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

Disable encoding after decoding. #69

Closed nkavian closed 3 years ago

nkavian commented 4 years ago

The very end of _decode performs a this.encode and compares it with the original.

Talking out loud here, but perhaps the right solution is to allow the developer to perform the encode/decode checking in their own code if they desire that level of verification and allow the library to optimize its performance?.

0x3333 commented 3 years ago

Sorry for the late response.

This library is a re-implementation of the Javascript version, for compatibility reasons, I believe this should not be changed.

Reference: https://github.com/niieani/hashids.js/blob/master/lib/hashids.ts#L275

nkavian commented 3 years ago

Not a problem, I've since moved away from hashid and use a different solution.

I understand the JavaScript compatibility concern. You could have still considered how to make this configurable to be more amenable to how things should work performantly in Java.