diff --git a/tinytor.py b/tinytor.py
index 40e11e0..e7b3ecc 100644
--- a/tinytor.py
+++ b/tinytor.py
@@ -186,16 +186,11 @@ class Consensus:
tor_port = int(split_line[7])
dir_port = int(split_line[8])
- while True:
- try:
- # The fingerprint here is base64 encoded bytes.
- # The descriptor URL uses the base16 encoded value of these bytes.
- # Documentation for this was hard to find...
- identity = b16encode(b64decode(identity.encode())).decode()
- break
- except binascii.Error:
- # Incorrect base64 padding.
- identity = identity + "="
+ # The fingerprint here is base64 encoded bytes.
+ # The descriptor URL uses the base16 encoded value of these bytes.
+ # Documentation for this was hard to find...
+ identity += '=' * (-len(identity) % 4)
+ identity = b16encode(b64decode(identity.encode())).decode()
onion_router = OnionRouter(nickname, ip, dir_port, tor_port, identity)
elif line.startswith("s "):
I've tried to make a PR but Github is completely broken today: https://twitter.com/lontivero/status/1054160998259658752
patch.txt