From 027b1e20fb1e3c500791ffe6300e2957b8221496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sat, 2 Dec 2017 17:18:12 +0100 Subject: [PATCH] added 'ascii' to str.encode() calls to support porting to other langs --- proofow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proofow.py b/proofow.py index ac20b9c..da06fb1 100644 --- a/proofow.py +++ b/proofow.py @@ -26,7 +26,7 @@ class pow_base: raise RuntimeError('Failed to find a nonce in {} iterations!'.format(max_attempts)) def verify(self, nonce): - hexresult = self._hexdigest(self._base + str(nonce).encode()) + hexresult = self._hexdigest(self._base + str(nonce).encode('ascii')) return int(hexresult, 16) < self._target def export(self): @@ -35,7 +35,7 @@ class pow_base: @classmethod def load(cls, export): difficulty, base = export.split(':', 1) - return cls(int(difficulty), b64decode(base.encode())) + return cls(int(difficulty), b64decode(base.encode('ascii'))) class pow_hashlib_base(pow_base):