klefki.curves.bns.bn128

ref: https://github.com/ethereum/research/blob/711bd9532b4534ef5ae6277bd7afe625195506d5/zksnark/bn128_field_elements.py

Module Contents

Classes

BN128FP

A FIELD is a set F which is closed under two operations + and × s.t.

BN128FP2

$U subseteq F$, where F is subfield, P is its module cof

BN128FP12

$U subseteq F$, where F is subfield, P is its module cof

BN128ScalarFP

A FIELD is a set F which is closed under two operations + and × s.t.

ECGBN128

y^2 = x^3 + A * x + B

class klefki.curves.bns.bn128.BN128FP(*args)

Bases: klefki.algebra.fields.FiniteField

A FIELD is a set F which is closed under two operations + and × s.t. (1) Fis an abelian group under + and (2) F-{0} (the set F without the additive identity 0) is an abelian group under ×.

P
class klefki.curves.bns.bn128.BN128FP2(*args)

Bases: klefki.algebra.fields.PolyExtField

$U subseteq F$, where F is subfield, P is its module cof

DEG = 2
F
P
classmethod from_BN128FP(cls, v)
class klefki.curves.bns.bn128.BN128FP12(*args)

Bases: klefki.algebra.fields.PolyExtField

$U subseteq F$, where F is subfield, P is its module cof

DEG = 12
F
P
classmethod from_BN128FP(cls, v)
classmethod from_BN128FP2(cls, v)
class klefki.curves.bns.bn128.BN128ScalarFP(*args)

Bases: klefki.algebra.fields.FiniteField

A FIELD is a set F which is closed under two operations + and × s.t. (1) Fis an abelian group under + and (2) F-{0} (the set F without the additive identity 0) is an abelian group under ×.

P
class klefki.curves.bns.bn128.ECGBN128(*args)

Bases: klefki.algebra.groups.ecg.PairFriendlyEllipticCurveGroup

y^2 = x^3 + A * x + B

A
N
F
op(self, g)

The Operator for obeying axiom associativity (2)

twist(self)
classmethod twist_FP_to_FP12(cls, x, y)
classmethod twist_FP2_to_FP12(cls, x, y)
static linefunc(P1, P2, T)
classmethod miller_loop(cls, Q, P)
classmethod pairing(cls, P, Q)

e(P, Q + R) = e(P, Qj * e(P, R) e(P + Q, R) = e(P, R) * e(Q, R)

is_on_curve(self)
static B(F=BN128FP)
classmethod lift_x(cls, x)
klefki.curves.bns.bn128.G1
klefki.curves.bns.bn128.G2
klefki.curves.bns.bn128.G