reworked export format to be more human-readable
This commit is contained in:
		@@ -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):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user