INNER CODE UNIT · Python
_preimage_first_run
demining/CryptoDeepTools · 17BTCRecoverCryptoGuide/lib/eth_hash/main.py:27
def _preimage_first_run(self, data):
new_preimage = self._backend.preimage
self.preimage = new_preimage
return new_preimage(data)
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
)