Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect encoding for 0 value. #5

Open
zerosym opened this issue May 10, 2021 · 0 comments
Open

Incorrect encoding for 0 value. #5

zerosym opened this issue May 10, 2021 · 0 comments

Comments

@zerosym
Copy link

zerosym commented May 10, 2021

The implementation of the hashids.to_alphabet function leads to different encodings for the value 0 compared to implementations in other languages. Specifically, if current_number begins as 0 the function is essentially skipped.

while current_number > 0 loop

Python:
https://github.com/davidaurelio/hashids-python/blob/09f879a1967836f1e399c12b745c24291e3e73ad/hashids.py#L43

Ruby:
https://github.com/peterhellberg/hashids.rb/blob/b729fe514e492e18d9f69473b53eb59a3b5aee4b/lib/hashids.rb#L163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant