Exemplo n.º 1
0
 def hash(self):
     writer = BinaryWriter(stream=bytearray())
     self.serialize_unsigned(writer)
     hash_data = writer._stream.getvalue()
     hash = hashlib.sha256(hashlib.sha256(hash_data).digest()).digest()
     writer.cleanup()
     return UInt256(data=hash)
Exemplo n.º 2
0
 def to_array(self) -> bytearray:
     writer = BinaryWriter(stream=bytearray())
     self.serialize(writer)
     data = bytearray(writer._stream.getvalue())
     writer.cleanup()
     return data