22
33use group:: { Group , GroupEncoding } ;
44
5- use crate :: group_morphism:: { GroupMorphismPreimage , msm_pr} ;
5+ use crate :: group_morphism:: { LinearRelation , msm_pr} ;
66
77/// Morphism for knowledge of a discrete logarithm relative to a fixed basepoint.
88#[ allow( non_snake_case) ]
99pub fn discrete_logarithm < G : Group + GroupEncoding > (
1010 x : G :: Scalar ,
11- ) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
12- let mut morphismp: GroupMorphismPreimage < G > = GroupMorphismPreimage :: new ( ) ;
11+ ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
12+ let mut morphismp: LinearRelation < G > = LinearRelation :: new ( ) ;
1313
1414 let var_x = morphismp. allocate_scalar ( ) ;
1515 let var_G = morphismp. allocate_element ( ) ;
@@ -27,11 +27,8 @@ pub fn discrete_logarithm<G: Group + GroupEncoding>(
2727
2828/// Morphism for knowledge of a discrete logarithm equality between two pairs.
2929#[ allow( non_snake_case) ]
30- pub fn dleq < G : Group + GroupEncoding > (
31- x : G :: Scalar ,
32- H : G ,
33- ) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
34- let mut morphismp: GroupMorphismPreimage < G > = GroupMorphismPreimage :: new ( ) ;
30+ pub fn dleq < G : Group + GroupEncoding > ( x : G :: Scalar , H : G ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
31+ let mut morphismp: LinearRelation < G > = LinearRelation :: new ( ) ;
3532
3633 let var_x = morphismp. allocate_scalar ( ) ;
3734 let [ var_G, var_H] = morphismp. allocate_elements ( ) ;
@@ -56,8 +53,8 @@ pub fn pedersen_commitment<G: Group + GroupEncoding>(
5653 H : G ,
5754 x : G :: Scalar ,
5855 r : G :: Scalar ,
59- ) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
60- let mut cs: GroupMorphismPreimage < G > = GroupMorphismPreimage :: new ( ) ;
56+ ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
57+ let mut cs: LinearRelation < G > = LinearRelation :: new ( ) ;
6158
6259 let [ var_x, var_r] = cs. allocate_scalars ( ) ;
6360 let [ var_G, var_H] = cs. allocate_elements ( ) ;
@@ -79,8 +76,8 @@ pub fn pedersen_commitment<G: Group + GroupEncoding>(
7976pub fn pedersen_commitment_dleq < G : Group + GroupEncoding > (
8077 generators : [ G ; 4 ] ,
8178 witness : [ G :: Scalar ; 2 ] ,
82- ) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
83- let mut morphismp: GroupMorphismPreimage < G > = GroupMorphismPreimage :: new ( ) ;
79+ ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
80+ let mut morphismp: LinearRelation < G > = LinearRelation :: new ( ) ;
8481
8582 let X = msm_pr :: < G > ( & witness, & [ generators[ 0 ] , generators[ 1 ] ] ) ;
8683 let Y = msm_pr :: < G > ( & witness, & [ generators[ 2 ] , generators[ 3 ] ] ) ;
@@ -112,8 +109,8 @@ pub fn bbs_blind_commitment_computation<G: Group + GroupEncoding>(
112109 [ Q_2 , J_1 , J_2 , J_3 ] : [ G ; 4 ] ,
113110 [ msg_1, msg_2, msg_3] : [ G :: Scalar ; 3 ] ,
114111 secret_prover_blind : G :: Scalar ,
115- ) -> ( GroupMorphismPreimage < G > , Vec < G :: Scalar > ) {
116- let mut morphismp = GroupMorphismPreimage :: new ( ) ;
112+ ) -> ( LinearRelation < G > , Vec < G :: Scalar > ) {
113+ let mut morphismp = LinearRelation :: new ( ) ;
117114
118115 // these are computed before the proof in the specification
119116 let C = Q_2 * secret_prover_blind + J_1 * msg_1 + J_2 * msg_2 + J_3 * msg_3;
0 commit comments