We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 07caba3 commit 504b1deCopy full SHA for 504b1de
1 file changed
hashids.py
@@ -56,11 +56,10 @@ def _unhash(hashed, alphabet):
56
"""Restores a number tuple from hashed using the given `alphabet` index."""
57
number = 0
58
len_alphabet = len(alphabet)
59
- base = 1
60
- for character in hashed[::-1]:
+ for character in hashed:
61
position = alphabet.index(character)
62
- number += position * base
63
- base *= len_alphabet
+ number *= len_alphabet
+ number += position
64
return number
65
66
0 commit comments