From ee5b0c08c520d6de9670371089f11825e2ad106f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sat, 2 Dec 2017 11:59:59 +0100 Subject: [PATCH] reworked export format to be more human-readable --- proofow.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/proofow.py b/proofow.py index e9d9aa2..ac20b9c 100644 --- a/proofow.py +++ b/proofow.py @@ -30,14 +30,12 @@ class pow_base: return int(hexresult, 16) < self._target def export(self): - return b64encode(str(self.difficulty).encode() - + b':' - + self.base).decode() + return str(self.difficulty) + ':' + b64encode(self.base).decode() @classmethod def load(cls, export): - difficulty, base = b64decode(export.encode()).split(b':', 1) - return cls(int(difficulty), base) + difficulty, base = export.split(':', 1) + return cls(int(difficulty), b64decode(base.encode())) class pow_hashlib_base(pow_base):