Beispiel #1
0
    def test_raw_to_hash_to_s(self):

        ba = bytearray(binascii.unhexlify(self.block_raw))
        hash = bin_dbl_sha256(ba)
        hashhex = binascii.hexlify(hash)

        uint256bytes = bytearray(binascii.unhexlify(hashhex))
        uint256bytes.reverse()
        out = uint256bytes.hex()

        self.assertEqual(out, self.rout)
Beispiel #2
0
    def GetChecksum(value):
        """
        Get the double SHA256 hash of the value.

        Args:
            value (obj): a payload

        Returns:

        """
        uint32 = bin_dbl_sha256(value)[:4]

        return int.from_bytes(uint32, 'little')
Beispiel #3
0
    def GetChecksum(value):
        """
        Get the double SHA256 hash of the value.

        Args:
            value (obj): a payload

        Returns:

        """
        uint32 = bin_dbl_sha256(value)[:4]

        return int.from_bytes(uint32, 'little')
Beispiel #4
0
    def Hash(self):
        """
        Get the hash value of the Blockbase.

        Returns:
            UInt256: containing the hash of the data.
        """
        if not self.__hash:
            hashdata = self.RawData()
            ba = bytearray(binascii.unhexlify(hashdata))
            hash = bin_dbl_sha256(ba)
            self.__hash = UInt256(data=hash)

        return self.__hash
Beispiel #5
0
    def Hash(self):
        """
        Get the hash value of the Blockbase.

        Returns:
            UInt256: containing the hash of the data.
        """
        if not self.__hash:
            hashdata = self.RawData()
            ba = bytearray(binascii.unhexlify(hashdata))
            hash = bin_dbl_sha256(ba)
            self.__hash = UInt256(data=hash)

        return self.__hash
Beispiel #6
0
    def test_raw_to_hash(self):
        ba = bytearray(binascii.unhexlify(self.block_raw))
        hash = bin_dbl_sha256(ba)
        hashhex = binascii.hexlify(hash)

        self.assertEqual(hashhex, self.uint256val)
 def Hash(self):
     if not self._hash:
         self._hash = bin_dbl_sha256(Helper.GetHashData(self))
     return self._hash
Beispiel #8
0
 def Hash(self):
     if not self._hash:
         self._hash = bin_dbl_sha256(Helper.GetHashData(self))
     return self._hash