Public key recovery from [secp256k1] ECDSA signatures.
[secp256k1]: https://en.bitcoin.it/wiki/Secp256k1
_This module provides low-level cryptographic building blocks that must be
used carefully to ensure proper security. Read this documentation and
accompanying links thoroughly._
The [`secp256k1_recover`] syscall allows a secp256k1 public key that has
previously signed a message to be recovered from the combination of the
message, the signature, and a recovery ID. The recovery ID is generated
during signing.
Use cases for `secp256k1_recover` include:
- Implementing the Ethereum [`ecrecover`] builtin contract.
- Performing secp256k1 public key recovery generally.
- Verifying a single secp256k1 signature.
While `secp256k1_recover` can be used to verify secp256k1 signatures, Solana
also provides the [secp256k1 program][sp], which is more flexible, has lower CPU
cost, and can validate many signatures at once.
[sp]: https://docs.rs/solana-program/latest/solana_program/secp256k1_program/
[`ecrecover`]: https://docs.soliditylang.org/en/v0.8.14/units-and-global-variables.html?highlight=ecrecover#mathematical-and-cryptographic-functions