예제 #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)
예제 #2
0
 def to_array(self) -> bytearray:
     writer = BinaryWriter(stream=bytearray())
     self.serialize(writer)
     data = bytearray(writer._stream.getvalue())
     writer.cleanup()
     return data