MCPcopy Create free account
hub / github.com/ElementsProject/elements / byte_to_base58

Function byte_to_base58

test/functional/test_framework/address.py:59–70  ·  view source on GitHub ↗
(b, version)

Source from the content-addressed store, hash-verified

57
58
59def byte_to_base58(b, version):
60 result = ''
61 b = bytes([version]) + b # prepend version
62 b += hash256(b)[:4] # append checksum
63 value = int.from_bytes(b, 'big')
64 while value > 0:
65 result = chars[value % 58] + result
66 value //= 58
67 while b[0] == 0:
68 result = chars[0] + result
69 b = b[1:]
70 return result
71
72
73def base58_to_byte(s):

Callers 4

bytes_to_wifFunction · 0.90
keyhash_to_p2pkhFunction · 0.70
scripthash_to_p2shFunction · 0.70
check_base58Method · 0.70

Calls 1

hash256Function · 0.70

Tested by

no test coverage detected