(s)
| 48 | |
| 49 | |
| 50 | def decode_base58(s): |
| 51 | num = 0 |
| 52 | for c in s: |
| 53 | num *= 58 |
| 54 | num += BASE58_ALPHABET.index(c) |
| 55 | combined = num.to_bytes(25, byteorder='big') |
| 56 | checksum = combined[-4:] |
| 57 | if hash256(combined[:-4])[:4] != checksum: |
| 58 | raise ValueError('bad address: {} {}'.format(checksum, hash256(combined[:-4])[:4])) |
| 59 | return combined[1:-4] |
| 60 | |
| 61 | |
| 62 | def little_endian_to_int(b): |