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