@@ -9,42 +9,42 @@ use crate::linear_relation::{msm_pr, LinearRelation};
99pub fn discrete_logarithm < G : Group + GroupEncoding > (
1010 x : G :: Scalar ,
1111) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
12- let mut morphismp : LinearRelation < G > = LinearRelation :: new ( ) ;
12+ let mut linear_map : LinearRelation < G > = LinearRelation :: new ( ) ;
1313
14- let var_x = morphismp . allocate_scalar ( ) ;
15- let var_G = morphismp . allocate_element ( ) ;
14+ let var_x = linear_map . allocate_scalar ( ) ;
15+ let var_G = linear_map . allocate_element ( ) ;
1616
17- let var_X = morphismp . allocate_eq ( var_x * var_G) ;
17+ let var_X = linear_map . allocate_eq ( var_x * var_G) ;
1818
19- morphismp . set_element ( var_G, G :: generator ( ) ) ;
20- morphismp . compute_image ( & [ x] ) . unwrap ( ) ;
19+ linear_map . set_element ( var_G, G :: generator ( ) ) ;
20+ linear_map . compute_image ( & [ x] ) . unwrap ( ) ;
2121
22- let X = morphismp . linear_map . group_elements . get ( var_X) . unwrap ( ) ;
22+ let X = linear_map . linear_map . group_elements . get ( var_X) . unwrap ( ) ;
2323
2424 assert_eq ! ( X , G :: generator( ) * x) ;
25- ( morphismp , vec ! [ x] )
25+ ( linear_map , vec ! [ x] )
2626}
2727
2828/// LinearMap for knowledge of a discrete logarithm equality between two pairs.
2929#[ allow( non_snake_case) ]
3030pub fn dleq < G : Group + GroupEncoding > ( H : G , x : G :: Scalar ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
31- let mut morphismp : LinearRelation < G > = LinearRelation :: new ( ) ;
31+ let mut linear_map : LinearRelation < G > = LinearRelation :: new ( ) ;
3232
33- let var_x = morphismp . allocate_scalar ( ) ;
34- let [ var_G, var_H] = morphismp . allocate_elements ( ) ;
33+ let var_x = linear_map . allocate_scalar ( ) ;
34+ let [ var_G, var_H] = linear_map . allocate_elements ( ) ;
3535
36- let var_X = morphismp . allocate_eq ( var_x * var_G) ;
37- let var_Y = morphismp . allocate_eq ( var_x * var_H) ;
36+ let var_X = linear_map . allocate_eq ( var_x * var_G) ;
37+ let var_Y = linear_map . allocate_eq ( var_x * var_H) ;
3838
39- morphismp . set_elements ( [ ( var_G, G :: generator ( ) ) , ( var_H, H ) ] ) ;
40- morphismp . compute_image ( & [ x] ) . unwrap ( ) ;
39+ linear_map . set_elements ( [ ( var_G, G :: generator ( ) ) , ( var_H, H ) ] ) ;
40+ linear_map . compute_image ( & [ x] ) . unwrap ( ) ;
4141
42- let X = morphismp . linear_map . group_elements . get ( var_X) . unwrap ( ) ;
43- let Y = morphismp . linear_map . group_elements . get ( var_Y) . unwrap ( ) ;
42+ let X = linear_map . linear_map . group_elements . get ( var_X) . unwrap ( ) ;
43+ let Y = linear_map . linear_map . group_elements . get ( var_Y) . unwrap ( ) ;
4444
4545 assert_eq ! ( X , G :: generator( ) * x) ;
4646 assert_eq ! ( Y , H * x) ;
47- ( morphismp , vec ! [ x] )
47+ ( linear_map , vec ! [ x] )
4848}
4949
5050/// LinearMap for knowledge of an opening to a Pederson commitment.
@@ -77,29 +77,29 @@ pub fn pedersen_commitment_dleq<G: Group + GroupEncoding>(
7777 generators : [ G ; 4 ] ,
7878 witness : [ G :: Scalar ; 2 ] ,
7979) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
80- let mut morphismp : LinearRelation < G > = LinearRelation :: new ( ) ;
80+ let mut linear_map : LinearRelation < G > = LinearRelation :: new ( ) ;
8181
8282 let X = msm_pr :: < G > ( & witness, & [ generators[ 0 ] , generators[ 1 ] ] ) ;
8383 let Y = msm_pr :: < G > ( & witness, & [ generators[ 2 ] , generators[ 3 ] ] ) ;
8484
85- let [ var_x, var_r] = morphismp . allocate_scalars ( ) ;
85+ let [ var_x, var_r] = linear_map . allocate_scalars ( ) ;
8686
87- let var_Gs = morphismp . allocate_elements :: < 4 > ( ) ;
88- let [ var_X, var_Y] = morphismp . allocate_elements ( ) ;
87+ let var_Gs = linear_map . allocate_elements :: < 4 > ( ) ;
88+ let [ var_X, var_Y] = linear_map . allocate_elements ( ) ;
8989
90- morphismp . set_elements ( [
90+ linear_map . set_elements ( [
9191 ( var_Gs[ 0 ] , generators[ 0 ] ) ,
9292 ( var_Gs[ 1 ] , generators[ 1 ] ) ,
9393 ( var_Gs[ 2 ] , generators[ 2 ] ) ,
9494 ( var_Gs[ 3 ] , generators[ 3 ] ) ,
9595 ] ) ;
96- morphismp . set_elements ( [ ( var_X, X ) , ( var_Y, Y ) ] ) ;
96+ linear_map . set_elements ( [ ( var_X, X ) , ( var_Y, Y ) ] ) ;
9797
98- morphismp . append_equation ( var_X, [ ( var_x, var_Gs[ 0 ] ) , ( var_r, var_Gs[ 1 ] ) ] ) ;
99- morphismp . append_equation ( var_Y, [ ( var_x, var_Gs[ 2 ] ) , ( var_r, var_Gs[ 3 ] ) ] ) ;
98+ linear_map . append_equation ( var_X, [ ( var_x, var_Gs[ 0 ] ) , ( var_r, var_Gs[ 1 ] ) ] ) ;
99+ linear_map . append_equation ( var_Y, [ ( var_x, var_Gs[ 2 ] ) , ( var_r, var_Gs[ 3 ] ) ] ) ;
100100
101- assert ! ( vec![ X , Y ] == morphismp . linear_map. evaluate( & witness) . unwrap( ) ) ;
102- ( morphismp , witness. to_vec ( ) )
101+ assert ! ( vec![ X , Y ] == linear_map . linear_map. evaluate( & witness) . unwrap( ) ) ;
102+ ( linear_map , witness. to_vec ( ) )
103103}
104104
105105/// LinearMap for knowledge of an opening for use in a BBS commitment.
@@ -110,26 +110,26 @@ pub fn bbs_blind_commitment_computation<G: Group + GroupEncoding>(
110110 [ msg_1, msg_2, msg_3] : [ G :: Scalar ; 3 ] ,
111111 secret_prover_blind : G :: Scalar ,
112112) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
113- let mut morphismp = LinearRelation :: new ( ) ;
113+ let mut linear_map = LinearRelation :: new ( ) ;
114114
115115 // these are computed before the proof in the specification
116116 let C = Q_2 * secret_prover_blind + J_1 * msg_1 + J_2 * msg_2 + J_3 * msg_3;
117117
118118 // This is the part that needs to be changed in the specification of blind bbs.
119- let [ var_secret_prover_blind, var_msg_1, var_msg_2, var_msg_3] = morphismp . allocate_scalars ( ) ;
119+ let [ var_secret_prover_blind, var_msg_1, var_msg_2, var_msg_3] = linear_map . allocate_scalars ( ) ;
120120
121- let [ var_Q_2, var_J_1, var_J_2, var_J_3] = morphismp . allocate_elements ( ) ;
122- let var_C = morphismp . allocate_element ( ) ;
121+ let [ var_Q_2, var_J_1, var_J_2, var_J_3] = linear_map . allocate_elements ( ) ;
122+ let var_C = linear_map . allocate_element ( ) ;
123123
124- morphismp . set_elements ( [
124+ linear_map . set_elements ( [
125125 ( var_Q_2, Q_2 ) ,
126126 ( var_J_1, J_1 ) ,
127127 ( var_J_2, J_2 ) ,
128128 ( var_J_3, J_3 ) ,
129129 ( var_C, C ) ,
130130 ] ) ;
131131
132- morphismp . append_equation (
132+ linear_map . append_equation (
133133 var_C,
134134 [
135135 ( var_secret_prover_blind, var_Q_2) ,
@@ -141,6 +141,6 @@ pub fn bbs_blind_commitment_computation<G: Group + GroupEncoding>(
141141
142142 let witness = vec ! [ secret_prover_blind, msg_1, msg_2, msg_3] ;
143143
144- assert ! ( vec![ C ] == morphismp . linear_map. evaluate( & witness) . unwrap( ) ) ;
145- ( morphismp , witness)
144+ assert ! ( vec![ C ] == linear_map . linear_map. evaluate( & witness) . unwrap( ) ) ;
145+ ( linear_map , witness)
146146}
0 commit comments