MCPcopy Create free account
hub / github.com/ccxt/ccxt / binary_to_base58

Method binary_to_base58

python/ccxt/base/exchange.py:1954–1971  ·  view source on GitHub ↗
(b)

Source from the content-addressed store, hash-verified

1952
1953 @staticmethod
1954 def binary_to_base58(b):
1955 if Exchange.base58_encoder is None:
1956 Exchange.base58_decoder = {}
1957 Exchange.base58_encoder = {}
1958 for i, c in enumerate(Exchange.base58_alphabet):
1959 Exchange.base58_decoder[c] = i
1960 Exchange.base58_encoder[i] = c
1961 result = 0
1962 # undo decimal_to_bytes
1963 for byte in b:
1964 result *= 0x100
1965 result += byte
1966 string = []
1967 while result > 0:
1968 result, next_character = divmod(result, 58)
1969 string.append(Exchange.base58_encoder[next_character])
1970 string.reverse()
1971 return ''.join(string)
1972
1973 def parse_number(self, value, default=None):
1974 if value is None:

Callers 4

test_binary_to_base58Function · 0.95
test_base58_to_binaryFunction · 0.95
sign_messageMethod · 0.80
sign_messageMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by 2

test_binary_to_base58Function · 0.76
test_base58_to_binaryFunction · 0.76