check_ecdsa_signature
Verifies an ECDSA signature against a message hash and public key. Note: the verification algorithm implemented by this function slightly deviates from the standard ECDSA. While this does not allow to create valid signatures if one does not possess the private key, it means that the signature algorithm used should be modified accordingly. This function validates that s
and r
are not 0 or equal to the curve order, but does not check that r, s < stark_curve::ORDER
, which should be checked by the caller. # Arguments * message_hash
- The hash of the signed message * public_key
- The x-coordinate of the signer's public key point on the STARK curve * signature_r
- The r component of the ECDSA signature (x-coordinate of point R) * signature_s
- The s component of the ECDSA signature # Returns Returns true
if the signature is valid, false
otherwise. # Examples
use core::ecdsa::check_ecdsa_signature;
let message_hash = 0x2d6479c0758efbb5aa07d35ed5454d728637fceab7ba544d3ea95403a5630a8;
let pubkey = 0x1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca;
let r = 0x6ff7b413a8457ef90f326b5280600a4473fef49b5b1dcdfcd7f42ca7aa59c69;
let s = 0x23a9747ed71abc5cb956c0df44ee8638b65b3e9407deade65de62247b8fd77;
assert!(check_ecdsa_signature(message_hash, pubkey, r, s));
Fully qualified path: core::ecdsa::check_ecdsa_signature
pub fn check_ecdsa_signature(
message_hash: felt252, public_key: felt252, signature_r: felt252, signature_s: felt252,
) -> bool