Skip to content

Incorrect encoding for 0 value. #5

@zerosym

Description

@zerosym

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions