INNER CODE UNIT · Python
__call__
demining/CryptoDeepTools · 17BTCRecoverCryptoGuide/lib/eth_hash/main.py:32
def __call__(self, preimage: Union[bytes, bytearray]) -> bytes:
if not isinstance(preimage, (bytes, bytearray)):
raise TypeError(
"Can only compute the hash of `bytes` or `bytearray` values, not %r" % preimage
)
return self.hasher(preimage)
def new(self, preimage: (Union[bytes, bytearray])) -> BasePreImage:
if not isinstance(preimage, (bytes, bytearray)):
raise TypeError(
"Can only compute the hash of `bytes` or `bytearray` values, not %r" % preimage
)
return self.preimage(preimage)