@@ -6,7 +6,7 @@ use sigma_rs::toolbox::sigma::{
66 GroupMorphismPreimage ,
77 SchnorrProof ,
88 transcript:: KeccakTranscript ,
9- NISigmaProtocol
9+ NISigmaProtocol ,
1010} ;
1111
1212type G = RistrettoPoint ;
@@ -138,7 +138,7 @@ fn bbs_blind_commitment_computation<G: Group + GroupEncoding>(
138138) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
139139 let mut morphismp: GroupMorphismPreimage < G > = GroupMorphismPreimage :: new ( ) ;
140140
141- // lenght (committed_messages)
141+ // length (committed_messages)
142142 let M = 3 ;
143143 // BBS.create_generators(M + 1, "BLIND_" || api_id)
144144 let ( Q_2 , J_1 , J_2 , J_3 ) = ( G :: random ( & mut * rng) , G :: random ( & mut * rng) , G :: random ( & mut * rng) , G :: random ( & mut * rng) ) ;
@@ -207,7 +207,7 @@ fn test_bbs_blind_commitment_computation() {
207207#[ test]
208208fn NI_discrete_logarithm ( ) {
209209 let mut rng = OsRng ;
210- let ( morphismp, witness) = bbs_blind_commitment_computation :: < G > ( & mut rng) ;
210+ let ( morphismp, witness) = discrete_logarithm :: < G > ( & mut rng) ;
211211
212212 // The SigmaProtocol induced by morphismp
213213 let protocol = SchnorrProof { morphismp } ;
@@ -220,4 +220,80 @@ fn NI_discrete_logarithm() {
220220 // Verify
221221 let verified = nizk. verify ( & proof_bytes) . is_ok ( ) ;
222222 assert ! ( verified, "Fiat-Shamir Schnorr proof verification failed" ) ;
223+ }
224+
225+ #[ allow( non_snake_case) ]
226+ #[ test]
227+ fn NI_dleq ( ) {
228+ let mut rng = OsRng ;
229+ let ( morphismp, witness) = dleq :: < G > ( & mut rng) ;
230+
231+ // The SigmaProtocol induced by morphismp
232+ let protocol = SchnorrProof { morphismp } ;
233+ // Fiat-Shamir wrapper
234+ let domain_sep = b"test-fiat-shamir-DLEQ" ;
235+ let mut nizk = NISigmaProtocol :: < SchnorrProof < G > , KeccakTranscript < G > , G > :: new ( domain_sep, protocol) ;
236+
237+ // Prove
238+ let proof_bytes = nizk. prove ( & witness, & mut rng) ;
239+ // Verify
240+ let verified = nizk. verify ( & proof_bytes) . is_ok ( ) ;
241+ assert ! ( verified, "DLEQ proof verification failed" ) ;
242+ }
243+
244+ #[ allow( non_snake_case) ]
245+ #[ test]
246+ fn NI_pedersen_commitment ( ) {
247+ let mut rng = OsRng ;
248+ let ( morphismp, witness) = pedersen_commitment :: < G > ( & mut rng) ;
249+
250+ // The SigmaProtocol induced by morphismp
251+ let protocol = SchnorrProof { morphismp } ;
252+ // Fiat-Shamir wrapper
253+ let domain_sep = b"test-fiat-shamir-pedersen-commitment" ;
254+ let mut nizk = NISigmaProtocol :: < SchnorrProof < G > , KeccakTranscript < G > , G > :: new ( domain_sep, protocol) ;
255+
256+ // Prove
257+ let proof_bytes = nizk. prove ( & witness, & mut rng) ;
258+ // Verify
259+ let verified = nizk. verify ( & proof_bytes) . is_ok ( ) ;
260+ assert ! ( verified, "DLEQ proof verification failed" ) ;
261+ }
262+
263+ #[ allow( non_snake_case) ]
264+ #[ test]
265+ fn NI_pedersen_commitment_dleq ( ) {
266+ let mut rng = OsRng ;
267+ let ( morphismp, witness) = pedersen_commitment_dleq :: < G > ( & mut rng) ;
268+
269+ // The SigmaProtocol induced by morphismp
270+ let protocol = SchnorrProof { morphismp } ;
271+ // Fiat-Shamir wrapper
272+ let domain_sep = b"test-fiat-shamir-pedersen-commitment-DLEQ" ;
273+ let mut nizk = NISigmaProtocol :: < SchnorrProof < G > , KeccakTranscript < G > , G > :: new ( domain_sep, protocol) ;
274+
275+ // Prove
276+ let proof_bytes = nizk. prove ( & witness, & mut rng) ;
277+ // Verify
278+ let verified = nizk. verify ( & proof_bytes) . is_ok ( ) ;
279+ assert ! ( verified, "DLEQ proof verification failed" ) ;
280+ }
281+
282+ #[ allow( non_snake_case) ]
283+ #[ test]
284+ fn NI_bbs_blind_commitment_computation ( ) {
285+ let mut rng = OsRng ;
286+ let ( morphismp, witness) = bbs_blind_commitment_computation :: < G > ( & mut rng) ;
287+
288+ // The SigmaProtocol induced by morphismp
289+ let protocol = SchnorrProof { morphismp } ;
290+ // Fiat-Shamir wrapper
291+ let domain_sep = b"test-fiat-shamir-bbs-blind-commitment-computation" ;
292+ let mut nizk = NISigmaProtocol :: < SchnorrProof < G > , KeccakTranscript < G > , G > :: new ( domain_sep, protocol) ;
293+
294+ // Prove
295+ let proof_bytes = nizk. prove ( & witness, & mut rng) ;
296+ // Verify
297+ let verified = nizk. verify ( & proof_bytes) . is_ok ( ) ;
298+ assert ! ( verified, "DLEQ proof verification failed" ) ;
223299}
0 commit comments