Helper method that restores the values encoded in a hashid without argument checks.
(hashid, salt, alphabet, separators, guards)
| 130 | |
| 131 | |
| 132 | def _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 | |
| 151 | def _deprecated(func, name): |