Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] GT MultiExp #212

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d90c332
feat(GT): exponentiation in the cyclotomic subgroups of E6, E12, E24
yelhousni Jan 4, 2022
feb3e16
perf(E12, E24, E6): exponentiation using 2-bit windowing method
yelhousni Jan 4, 2022
1587c99
feat(GT): exponentiation in GT using 2-dim windowed GLV
yelhousni Jan 24, 2022
095417b
feat(GT, bls12-377): bucket-list MSM
yelhousni Jan 24, 2022
4f7b346
Merge branch 'develop' into feat/GT-Exp
yelhousni Mar 16, 2022
e1db886
Merge branch 'feat/GT-Exp' into feat/GT-MSM
yelhousni Mar 16, 2022
4d1c7a4
Merge branch 'develop' into feat/GT-Exp
yelhousni Mar 22, 2022
f993ed9
fix: parameters of ExpGLV for the new curves
yelhousni Mar 22, 2022
61d93f7
style: unnecessary use of fmt.Sprintf
yelhousni Mar 23, 2022
8465c7e
Merge branch 'develop' into feat/GT-MSM
yelhousni Mar 23, 2022
fad325f
Merge branch 'feat/GT-Exp' into feat/GT-MSM
yelhousni Mar 23, 2022
8022ee1
test: MSM5 and MSM5 for GT
yelhousni Mar 23, 2022
c657828
feat: GT-MSM for BLS12-378
yelhousni Mar 23, 2022
fc32d6c
build: rebase on develop
yelhousni Jun 17, 2022
6ceeb90
fix: add GT-exp to bls24-317
yelhousni Jun 17, 2022
2fbe149
fix: handle negative exponent in Fp12 exp
yelhousni Jun 17, 2022
f848c12
fix: handle negative exponent in Fp24 and Fp6 exp
yelhousni Jun 18, 2022
55005b1
Merge branch 'develop' into feat/GT-Exp
yelhousni Jun 20, 2022
e382eb6
fix: golangci-lint
yelhousni Jun 20, 2022
5762868
test(tower): test negative exponent in Exp
yelhousni Jun 20, 2022
8573ee4
Merge branch 'feat/GT-exp' into feat/GT-MSM
yelhousni Jun 20, 2022
c92a1d8
feat: Multiexp à la Pippenger in GT
yelhousni Jun 20, 2022
8ad6473
refactor: code generation of MultiExp test in pairing_test
yelhousni Jun 20, 2022
bdab5f1
Merge branch 'develop' into feat/GT-MSM
yelhousni Jun 20, 2022
d890c8d
fix(bw6-633/GT): GT-MSM with widown size 5
yelhousni Jun 21, 2022
ad82889
Merge remote-tracking branch 'refs/remotes/origin/feat/GT-MSM' into f…
yelhousni Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: rebase on develop
yelhousni committed Jun 17, 2022
commit fc32d6c72b72b017a691ee745fcac14fca8ba67f
59 changes: 59 additions & 0 deletions ecc/bls24-317/pairing_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions internal/generator/tower/template/fq12over6over2/fq12.go.tmpl
Original file line number Diff line number Diff line change
@@ -680,4 +680,96 @@ func (z *E12) IsInSubGroup() bool {
{{$.To}}.SetBytes(e[{{$.OffSet}}:{{$.OffSet}} + fp.Bytes])
{{end}}

// CompressTorus GT/E12 element to half its size
// z must be in the cyclotomic subgroup
// i.e. z^(p^4-p^2+1)=1
// e.g. GT
// "COMPRESSION IN FINITE FIELDS AND TORUS-BASED CRYPTOGRAPHY", K. RUBIN AND A. SILVERBERG
// z.C1 == 0 only when z \in {-1,1}
func (z *E12) CompressTorus() (E6, error) {

if z.C1.IsZero() {
return E6{}, errors.New("invalid input")
}

var res, tmp, one E6
one.SetOne()
tmp.Inverse(&z.C1)
res.Add(&z.C0, &one).
Mul(&res, &tmp)

return res, nil
}

// BatchCompressTorus GT/E12 elements to half their size
// using a batch inversion
func BatchCompressTorus(x []E12) ([]E6, error) {

n := len(x)
if n == 0 {
return []E6{}, errors.New("invalid input size")
}

var one E6
one.SetOne()
res := make([]E6, n)

for i := 0; i < n; i++ {
res[i].Set(&x[i].C1)
}

t := BatchInvertE6(res) // costs 1 inverse

for i := 0; i < n; i++ {
res[i].Add(&x[i].C0, &one).
Mul(&res[i], &t[i])
}

return res, nil
}

// DecompressTorus GT/E12 a compressed element
// element must be in the cyclotomic subgroup
// "COMPRESSION IN FINITE FIELDS AND TORUS-BASED CRYPTOGRAPHY", K. RUBIN AND A. SILVERBERG
func (z *E6) DecompressTorus() E12 {

var res, num, denum E12
num.C0.Set(z)
num.C1.SetOne()
denum.C0.Set(z)
denum.C1.SetOne().Neg(&denum.C1)
res.Inverse(&denum).
Mul(&res, &num)

return res
}

// BatchDecompressTorus GT/E12 compressed elements
// using a batch inversion
func BatchDecompressTorus(x []E6) ([]E12, error) {

n := len(x)
if n == 0 {
return []E12{}, errors.New("invalid input size")
}

res := make([]E12, n)
num := make([]E12, n)
denum := make([]E12, n)

for i := 0; i < n; i++ {
num[i].C0.Set(&x[i])
num[i].C1.SetOne()
denum[i].C0.Set(&x[i])
denum[i].C1.SetOne().Neg(&denum[i].C1)
}

denum = BatchInvertE12(denum) // costs 1 inverse

for i := 0; i < n; i++ {
res[i].Mul(&num[i], &denum[i])
}

return res, nil
}
{{ template "base" .}}
You are viewing a condensed version of this merge commit. You can view the full changes here.