zkcrypto / bls12_381

Implementation of the BLS12-381 pairing-friendly elliptic curve group
Other
304 stars 178 forks source link

add feat: `impl Mul<Gt> for Gt` #115

Closed DougAnderson444 closed 4 months ago

DougAnderson444 commented 1 year ago

Feature request to implement impl Mul<Gt> for Gt

Currently we can only multiply Gt by a Scalar.

Similar to what is done here.

DougAnderson444 commented 1 year ago

I can make pull request for this

str4d commented 4 months ago

I think the issue here is one of nomenclature, and our code already provides the same logic.

Gt is a group, which is a set with an operation. In this crate we call that operation "addition" (i.e. we use additive notation). Under the hood, Gt's addition is implemented as multiplication over Fp12: https://github.com/zkcrypto/bls12_381/blob/f770b0d46d6ed824eea8dfe905f1e8cd01f5ad21/src/pairings.rs#L211 https://github.com/zkcrypto/bls12_381/blob/f770b0d46d6ed824eea8dfe905f1e8cd01f5ad21/src/pairings.rs#L279-L286

Currently we can only multiply Gt by a Scalar.

This is group scalar multiplication, i.e. repeated application of the group operator to group elements. In our case, repeated addition.

I suspect that the referenced code is instead using multiplicative notation; this seems to match the fact that it has a pow function for exponentiation, which would be the multiplicative equivalent of our scalar multiplication.

str4d commented 4 months ago

Closing as resolved. If you have further questions, or can point to something where our Gt addition operator does not behave the same as their multiplication operator, please re-open the issue.