modify g1_lincomb and g2_lincomb
This commit is contained in:
parent
d55da1bdb1
commit
5eb19b3cef
|
@ -130,13 +130,13 @@ def coset_evals_to_cell(coset_evals: CosetEvals) -> Cell:
|
|||
```python
|
||||
def g2_lincomb(points: Sequence[G2Point], scalars: Sequence[BLSFieldElement]) -> Bytes96:
|
||||
"""
|
||||
BLS multiscalar multiplication in G2. This function can be optimized using Pippenger's algorithm and variants.
|
||||
BLS multiscalar multiplication in G2. This can be naively implemented using double-and-add.
|
||||
"""
|
||||
assert len(points) == len(scalars)
|
||||
points_g2 = []
|
||||
for point in points:
|
||||
points_g2.append(bls.bytes96_to_G2(point))
|
||||
result = bls.g2_multi_exp(points_g2, scalars)
|
||||
result = bls.multi_exp(points_g2, scalars)
|
||||
return Bytes96(bls.G2_to_bytes96(result))
|
||||
```
|
||||
|
||||
|
|
|
@ -274,13 +274,13 @@ def div(x: BLSFieldElement, y: BLSFieldElement) -> BLSFieldElement:
|
|||
```python
|
||||
def g1_lincomb(points: Sequence[KZGCommitment], scalars: Sequence[BLSFieldElement]) -> KZGCommitment:
|
||||
"""
|
||||
BLS multiscalar multiplication. This function can be optimized using Pippenger's algorithm and variants.
|
||||
BLS multiscalar multiplication in G1. This can be naively implemented using double-and-add.
|
||||
"""
|
||||
assert len(points) == len(scalars)
|
||||
points_g1 = []
|
||||
for point in points:
|
||||
points_g1.append(bls.bytes48_to_G1(point))
|
||||
result = bls.g1_multi_exp(points_g1, scalars)
|
||||
result = bls.multi_exp(points_g1, scalars)
|
||||
return KZGCommitment(bls.G1_to_bytes48(result))
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue