reworked export format to be more human-readable
This commit is contained in:
parent
b95982818e
commit
ee5b0c08c5
@ -30,14 +30,12 @@ class pow_base:
|
|||||||
return int(hexresult, 16) < self._target
|
return int(hexresult, 16) < self._target
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
return b64encode(str(self.difficulty).encode()
|
return str(self.difficulty) + ':' + b64encode(self.base).decode()
|
||||||
+ b':'
|
|
||||||
+ self.base).decode()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, export):
|
def load(cls, export):
|
||||||
difficulty, base = b64decode(export.encode()).split(b':', 1)
|
difficulty, base = export.split(':', 1)
|
||||||
return cls(int(difficulty), base)
|
return cls(int(difficulty), b64decode(base.encode()))
|
||||||
|
|
||||||
|
|
||||||
class pow_hashlib_base(pow_base):
|
class pow_hashlib_base(pow_base):
|
||||||
|
Loading…
Reference in New Issue
Block a user