unshETH - Dependencies
ECDSA-I.sol
Note
Split reference
This reference file was too long so it is split into multiple chunks. This is chunk number I.
This Solidity file defines a library (ECDSA) for operations related to the Elliptic Curve Digital Signature Algorithm (ECDSA). This library is useful for verifying that a message was signed by the holder of the private keys of a given address. It provides functions for signature recovery, error handling, and creating Ethereum signed messages.
ECDSA
A library providing Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
Errors
- InvalidSignature: The provided signature is invalid.
- InvalidSignatureLength: The length of the provided signature is invalid.
- InvalidSignatureS: The 's' value in the provided signature is invalid.
RecoverError
(NoError
| InvalidSignature
| InvalidSignatureLength
| InvalidSignatureS
| InvalidSignatureV
): Enumeration of possible recover errors.
tryRecover
tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError)
Tries to recover the signer address from a signature.
Parameters
- hash bytes32: The hashed message that was signed.
- signature bytes: The signature to recover from.
Return Values
- tuple: The address that signed the message and any error that occurred.
recover
recover(bytes32 hash, bytes memory signature) internal pure returns (address)
Recovers the signer address from a signature.
Parameters
- hash bytes32: The hashed message that was signed.
- signature bytes: The signature to recover from.
Return Values
- address: The address that signed the message.
toEthSignedMessageHash
toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32)
Returns an Ethereum Signed Message, created from a hash.
Parameters
- hash bytes32: The hash to create the Ethereum Signed Message from.
Return Values
- bytes32: The Ethereum Signed Message.