Documentation ¶
Overview ¶
Package bn256 implements a particular bilinear group at the 128-bit security level.
Bilinear groups are the basis of many of the new cryptographic protocols that have been proposed over the past decade. They consist of a triplet of groups (G₁, G₂ and GT) such that there exists a function e(g₁ˣ,g₂ʸ)=gTˣʸ (where gₓ is a generator of the respective group). That function is called a pairing function.
This package specifically implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve as described in http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible with the implementation described in that paper.
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
Index ¶
- Variables
- func PairingCheck(a []*G1, b []*G2) bool
- type G1
- func (g *G1) Add(a, b *G1) *G1
- func (g *G1) CurvePoints() (*big.Int, *big.Int, *big.Int, *big.Int)
- func (g *G1) Marshal() []byte
- func (g *G1) Neg(a *G1) *G1
- func (g *G1) ScalarBaseMult(k *big.Int) *G1
- func (g *G1) ScalarMult(a *G1, k *big.Int) *G1
- func (g *G1) String() string
- func (g *G1) Unmarshal(m []byte) (*G1, bool)
- type G2
- type GT
- Bugs
Constants ¶
This section is empty.
Variables ¶
var Order = bigFromBase10("21888242871839275222246405745257275088548364400416034343698204186575808495617")
Order is the number of elements in both G₁ and G₂: 36u⁴+36u³+18u²+6u+1.
var P = bigFromBase10("21888242871839275222246405745257275088696311157297823662689037894645226208583")
P is a prime over which we form a basic field: 36u⁴+36u³+24u²+6u+1.
Functions ¶
func PairingCheck ¶
PairingCheck calculates the Optimal Ate pairing for a set of points.
Types ¶
type G1 ¶
G1 is an abstract cyclic group. The zero value is suitable for use as the output of an operation, but cannot be used as an input.
func (*G1) Add ¶
func (g *G1) Add(a, b *G1) *G1
Add sets e to a+b and then returns e. BUG(agl): this function is not complete: a==b fails.
func (*G1) CurvePoints ¶
CurvePoints returns p's curve points in big integer
func (*G1) ScalarBaseMult ¶
ScalarBaseMult sets e to g*k where g is the generator of the group and then returns e.
func (*G1) ScalarMult ¶
ScalarMult sets e to a*k and then returns e.
type G2 ¶
G2 is an abstract cyclic group. The zero value is suitable for use as the output of an operation, but cannot be used as an input.
func (*G2) Add ¶
func (g *G2) Add(a, b *G2) *G2
Add sets e to a+b and then returns e. BUG(agl): this function is not complete: a==b fails.
func (*G2) CurvePoints ¶
func (g *G2) CurvePoints() (*gfP2, *gfP2, *gfP2, *gfP2)
CurvePoints returns the curve points of p which includes the real and imaginary parts of the curve point.
func (*G2) ScalarBaseMult ¶
ScalarBaseMult sets e to g*k where g is the generator of the group and then returns out.
func (*G2) ScalarMult ¶
ScalarMult sets e to a*k and then returns e.
type GT ¶
type GT struct {
// contains filtered or unexported fields
}
GT is an abstract cyclic group. The zero value is suitable for use as the output of an operation, but cannot be used as an input.
func (*GT) ScalarMult ¶
ScalarMult sets e to a*k and then returns e.
Notes ¶
Bugs ¶
this implementation is not constant time.
this function is not complete: a==b fails.
this function is not complete: a==b fails.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bn256 implements a particular bilinear group at the 128-bit security level.
|
Package bn256 implements a particular bilinear group at the 128-bit security level. |
Package bn256 implements a particular bilinear group.
|
Package bn256 implements a particular bilinear group. |