Both signature schemes follow a similar pattern with a Cairo struct containing the signature data and a hint for efficient verification. Garaga provide tooling in Python/Rust/Javascript to generate the full expected Cairo struct given signature information. \
Both are working with all in Garaga, using the corresponding curve identifier. \
use garaga::signatures::schnorr::{
SchnorrSignatureWithHint, is_valid_schnorr_signature,
};
fn test_schnorr_BN254() {
let mut sch_sig_with_hints_serialized = array![
25818539331857930040314617978,
78090694603461972387174096825,
2703818907845027019,
0,
181762454779927841107875196039457683983,
28215594864971818583502469914456645564,
25093249062797173789773481043814634714,
28090073083341299544504024785600791580,
28610756795125421341789836686,
867082125726060679479563787,
517675042607557601,
0,
74669468252610898339759914706,
72459310451373670527166081349,
567344248591793433,
0,
38325661348877783211976497530,
35462761860755869492142061064,
2290891383729020262,
0,
41888403965386499220509717377,
24880030827500007371349674511,
166822982240436033,
0,
18491090926730934087002805824,
67882993143769697893850332707,
1614341497221428780,
0,
0,
]
.span(); // NOTE : This was shortened for conciseness, this won't work, actual
// Array is larger !
let sch_with_hints = Serde::<
SchnorrSignatureWithHint,
>::deserialize(ref sch_sig_with_hints_serialized)
.unwrap();
let is_valid = is_valid_schnorr_signature(sch_with_hints, 0);
}
Schnorr Signature With Hint generation
Simply pass your signature information to the class/function to obtain the calldata that you can deserialize inside Cairo into the ECDSASignatureWithHint struct. This is the input needed for the is_valid_ecdsa_signature function. Do not forget to use the correct curve identifier (see ). All three implementations (Python/Rust/JavaScript) are strictly equivalent and take an ECDSA signature data and return the serialized Cairo array as a list of integers
See
See
See
Simply pass your signature information to the class or function and obtain the calldata that you can deserialize inside Cairo into the SchnorrSignatureWithHint struct. This is the input needed for the is_valid_schnorr_signature function. Do not forget to use the correct curve identifier (see ). All three implementations (Python, Rust, JavaScript) are strictly equivalent and take Schnorr signature data, returning the serialized Cairo array as a list of integers.