Skip to main content
Recovers the public key from an ECDSA signature and message hash. Given a valid ECDSA signature, the original message hash, and the y-coordinate parity of point R, this function recovers the signer’s public key. This is useful in scenarios where you need to verify a message has been signed by a specific public key.

Signature

Arguments

  • message_hash - The hash of the signed message
  • signature_r - The r component of the ECDSA signature (x-coordinate of point R)
  • signature_s - The s component of the ECDSA signature
  • y_parity - The parity of the y-coordinate of point R (true for odd, false for even)

Returns

Returns Some(public_key) containing the x-coordinate of the recovered public key point if the signature is valid, None otherwise.

Examples