added 'ascii' to str.encode() calls to support porting to other langs
This commit is contained in:
parent
ee5b0c08c5
commit
027b1e20fb
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user