MCPcopy Index your code
hub / github.com/davidaurelio/hashids-python / _decode

Function _decode

hashids.py:132–148  ·  view source on GitHub ↗

Helper method that restores the values encoded in a hashid without argument checks.

(hashid, salt, alphabet, separators, guards)

Source from the content-addressed store, hash-verified

130
131
132def _decode(hashid, salt, alphabet, separators, guards):
133 """Helper method that restores the values encoded in a hashid without
134 argument checks."""
135 parts = tuple(_split(hashid, guards))
136 hashid = parts[1] if 2 <= len(parts) <= 3 else parts[0]
137
138 if not hashid:
139 return
140
141 lottery_char = hashid[0]
142 hashid = hashid[1:]
143
144 hash_parts = _split(hashid, separators)
145 for part in hash_parts:
146 alphabet_salt = (lottery_char + salt + alphabet)[:len(alphabet)]
147 alphabet = _reorder(alphabet, alphabet_salt)
148 yield _unhash(part, alphabet)
149
150
151def _deprecated(func, name):

Callers 1

decodeMethod · 0.85

Calls 3

_splitFunction · 0.85
_reorderFunction · 0.85
_unhashFunction · 0.85

Tested by

no test coverage detected