def ToScriptHash(scripts): """ Get a hash of the provided message using the ripemd160 algorithm. Args: scripts (str): message to hash. Returns: str: hash as a double digit hex string. """ return Crypto.Hash160(scripts)
def RawBytesToScriptHash(raw): """ Get a hash of the provided raw bytes using the ripemd160 algorithm. Args: raw (bytes): byte array of raw bytes. e.g. b'\xAA\xBB\xCC' Returns: UInt160: """ rawh = binascii.unhexlify(raw) rawhashstr = binascii.unhexlify( bytes(Crypto.Hash160(rawh), encoding='utf-8')) return UInt160(data=rawhashstr)
def ToScriptHash(self): return Crypto.Hash160(self.ScriptHash)
def Add(self, script: bytearray) -> None: self.data[Crypto.Hash160(script)] = script