From 6a68a0c8b62c7f4364b32890ee7eba343dbb7954 Mon Sep 17 00:00:00 2001 From: The Antius Date: Sun, 27 Jul 2014 03:31:45 +0200 Subject: [PATCH] Change decodeBase58 --- src/addresses.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/addresses.py b/src/addresses.py index 5f666543..b9135d04 100644 --- a/src/addresses.py +++ b/src/addresses.py @@ -42,14 +42,12 @@ def decodeBase58(string, alphabet=ALPHABET): - `alphabet`: The alphabet to use for encoding """ base = len(alphabet) - strlen = len(string) num = 0 - + try: - power = strlen - 1 for char in string: - num += alphabet.index(char) * (base ** power) - power -= 1 + num *= base + num += alphabet.index(char) except: #character not found (like a space character or a 0) return 0