Change decodeBase58
This commit is contained in:
parent
bb48f44968
commit
6a68a0c8b6
|
@ -42,14 +42,12 @@ def decodeBase58(string, alphabet=ALPHABET):
|
||||||
- `alphabet`: The alphabet to use for encoding
|
- `alphabet`: The alphabet to use for encoding
|
||||||
"""
|
"""
|
||||||
base = len(alphabet)
|
base = len(alphabet)
|
||||||
strlen = len(string)
|
|
||||||
num = 0
|
num = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
power = strlen - 1
|
|
||||||
for char in string:
|
for char in string:
|
||||||
num += alphabet.index(char) * (base ** power)
|
num *= base
|
||||||
power -= 1
|
num += alphabet.index(char)
|
||||||
except:
|
except:
|
||||||
#character not found (like a space character or a 0)
|
#character not found (like a space character or a 0)
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user