def ecrecover

bend-collections-laws-crypto@1.0.0.0 · src/crypto/secp256k1/ecdsa.bend:365

import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/ecdsa.bend as Ecdsa
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/bytes.bend as B

365# The precompile's semantics (Ethereum yellow paper appendix E): the input,
366# zero-padded or cut to 128 bytes, is hash || v || r || s (32 bytes each,
367# big-endian); v must be 27 or 28. The output is the 32-byte word holding
368# the signer's address, or None (the precompile's empty output) when v, r
369# or s is invalid or no key is recovered.
370def ecrecover(input: List<&2, U32>) -> Maybe<&2, List<&2, U32>>:
371  ecrecover_in(B.prefix(128n, cat(input, fill(128n, 0))))

Uses (7)

Used by (2)