Signatures
tip
Many signature schemes are maintained as independent libraries outside of the standard library (e.g. EdDSA, RSA, Schnorr). You can find the complete list in Awesome Noir's Signatures section.
ecdsa_secp256k1::verify_signature
Verifier for ECDSA Secp256k1 signatures.
ecdsa_secp256k1
pub fn verify_signature(
public_key_x: [u8; 32],
public_key_y: [u8; 32],
signature: [u8; 64],
message_hash: [u8; 32],
) -> bool
Source code: noir_stdlib/src/ecdsa_secp256k1.nr#L44-L51
Returns false for invalid inputs (zero r or s, not normalized, public key not on the curve).
example:
fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) {
let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message);
assert(valid_signature);
}
This is a black box function. Read this section to learn more about black box functions in Noir.
ecdsa_secp256r1::verify_signature
Verifier for ECDSA Secp256r1 signatures.
ecdsa_secp256r1
pub fn verify_signature(
public_key_x: [u8; 32],
public_key_y: [u8; 32],
signature: [u8; 64],
message_hash: [u8; 32],
) -> bool
Source code: noir_stdlib/src/ecdsa_secp256r1.nr#L44-L51
Returns false for invalid inputs (zero r or s, not normalized, public key not on the curve).
example:
fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) {
let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message);
assert(valid_signature);
}
This is a black box function. Read this section to learn more about black box functions in Noir.