Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit 428ecc6

Browse files
authored
Update base58.py
1 parent 62927f4 commit 428ecc6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

base58.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
""" base58 encoding / decoding functions """
2-
2+
# https://pastebin.com/TghewQTM
33
alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
44
base_count = len(alphabet)
55

66
def encode(num):
77
""" Returns num in a base58-encoded string """
88
encode = ''
9-
9+
1010
if (num < 0):
1111
return ''
12-
12+
1313
while (num >= base_count):
1414
mod = num % base_count
1515
encode = alphabet[mod] + encode
1616
num = num // base_count
17-
17+
1818
if (num):
1919
encode = alphabet[num] + encode
20-
20+
2121
return encode
2222

2323
def decode(s):
@@ -28,5 +28,5 @@ def decode(s):
2828
for char in s:
2929
decoded += multi * alphabet.index(char)
3030
multi = multi * base_count
31-
31+
3232
return decoded

0 commit comments

Comments
 (0)