@@ -60,7 +60,7 @@ impl SchnorrSignature {
6060 /// to their coordinates representation to feed them to the hash function.
6161 /// - Check: c == c_tilde
6262 ///
63- pub fn verify ( & self , msg : & [ u8 ] , vk : & SchnorrVerificationKey ) -> Result < ( ) > {
63+ pub fn verify ( & self , msg : & [ u8 ] , verification_key : & SchnorrVerificationKey ) -> Result < ( ) > {
6464 let generator = JubjubSubgroup :: generator ( ) ;
6565
6666 // First hashing the message to a scalar then hashing it to a curve point
@@ -76,26 +76,25 @@ impl SchnorrSignature {
7676 let vk_times_challenge = vk. 0 * self . challenge ;
7777 let random_value_2_recomputed = generator_times_s + vk_times_challenge;
7878
79- let ( hashx, hashy) = get_coordinates_extended ( hash_msg) ;
80- let ( vkx, vky) = get_coordinates_subgroup ( vk. 0 ) ;
81- let ( sigmax, sigmay) = get_coordinates_extended ( self . sigma ) ;
82- let ( r1x, r1y) = get_coordinates_extended ( random_value_1_recomputed) ;
83- let ( r2x, r2y) = get_coordinates_subgroup ( random_value_2_recomputed) ;
84-
79+ let ( hash_msg_x, hash_msg_y) = get_coordinates_extended ( hash_msg) ;
80+ let ( verification_key_x, verification_key_y) = get_coordinates_subgroup ( verification_key. 0 ) ;
81+ let ( sigma_x, sigma_y) = get_coordinates_extended ( self . sigma ) ;
82+ let ( random_value_1_recomputed_x, random_value_1_recomputed_y) = get_coordinates_extended ( random_value_1_recomputed) ;
83+ let ( random_value_2_recomputed_x, random_value_2_recomputed_y) = get_coordinates_subgroup ( random_value_2_recomputed) ;
8584 let challenge_recomputed = Hash :: digest_truncated (
8685 Domain :: Other ,
8786 & [
8887 DST_SIGNATURE ,
89- hashx ,
90- hashy ,
91- vkx ,
92- vky ,
93- sigmax ,
94- sigmay ,
95- r1x ,
96- r1y ,
97- r2x ,
98- r2y ,
88+ hash_msg_x ,
89+ hash_msg_y ,
90+ verification_key_x ,
91+ verification_key_y ,
92+ sigma_x ,
93+ sigma_y ,
94+ random_value_1_recomputed_x ,
95+ random_value_1_recomputed_y ,
96+ random_value_2_recomputed_x ,
97+ random_value_2_recomputed_y ,
9998 ] ,
10099 ) [ 0 ] ;
101100
@@ -107,24 +106,6 @@ impl SchnorrSignature {
107106 Ok ( ( ) )
108107 }
109108
110- /// Dense mapping function indexed by the index to be evaluated adapted to the Schnorr signature.
111- ///
112- /// We need to convert the inputs to fit in a Poseidon hash.
113- /// The order of the hash input must be the same as the one in the SNARK circuit
114- /// `ev = H(DST || msg || index || σ) <- MSP.Eval(msg,index,σ)` given in paper.
115- pub ( crate ) fn evaluate_dense_mapping ( & self , msg : & [ u8 ] , index : Index ) -> Result < [ u8 ; 32 ] > {
116- let hash = JubjubExtended :: hash_to_point ( msg) ;
117- let ( hashx, hashy) = get_coordinates_extended ( hash) ;
118- // TODO: Check if this is the correct way to add the index
119- let idx = JubjubBase :: from_raw ( [ 0 , 0 , 0 , index] ) ;
120- let ( sigmax, sigmay) = get_coordinates_extended ( self . sigma ) ;
121- let ev = Hash :: digest_truncated (
122- Domain :: Other ,
123- & [ DST_LOTTERY , hashx, hashy, idx, sigmax, sigmay] ,
124- ) [ 0 ] ;
125-
126- Ok ( ev. to_bytes ( ) )
127- }
128109
129110 /// Convert an `SchnorrSignature` to a byte representation.
130111 pub fn to_bytes ( self ) -> [ u8 ; 96 ] {
0 commit comments