MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / decodeBase58

Function decodeBase58

src/addresses.py:38–55  ·  view source on GitHub ↗

Decode a Base X encoded string into the number Arguments: - `string`: The encoded string - `alphabet`: The alphabet to use for encoding

(string, alphabet=ALPHABET)

Source from the content-addressed store, hash-verified

36 return ''.join(arr)
37
38def decodeBase58(string, alphabet=ALPHABET):
39 """Decode a Base X encoded string into the number
40
41 Arguments:
42 - `string`: The encoded string
43 - `alphabet`: The alphabet to use for encoding
44 """
45 base = len(alphabet)
46 num = 0
47
48 try:
49 for char in string:
50 num *= base
51 num += alphabet.index(char)
52 except:
53 #character not found (like a space character or a 0)
54 return 0
55 return num
56
57def encodeVarint(integer):
58 if integer < 0:

Callers 1

decodeAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected