## Bilinear Pairing Parameters Generators

Notice that, the parameters generated by PBC can be used by JPBC without any known issue.

### Type A

Type A pairings are constructed on the curve y^2=x^3+x over the field \mathbb{F}_q for some prime q=3 \mod 4. Both \mathbb{G}_1 and \mathbb{G}_2 are the group of points E(\mathbb{F}_q), so this pairing is symmetric. The order r is some prime factor of q+1.

Further information are available here.

For Type A pairing, JPBC provides a ported and a PBC wrapped generator. Here is the code to use them.

```import it.unisa.dia.gas.plaf.jpbc.pairing.a.TypeACurveGenerator;
import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeACurveGenerator;

int rBits = 160;
int qBits = 512;

// JPBC Type A pairing generator...
ParametersGenerator pg = new TypeACurveGenerator(rBits, qBits);
// PBC Type A pairing generator...
ParametersGenerator pbcPg = new PBCTypeACurveGenerator(rBits, qBits);
```

Type A1 uses the same equation, but have different fields. It supports fields of composite order.
Also for Type A1 pairing, JPBC provides a ported and a PBC wrapped generator. Here is the code to use them.

```import it.unisa.dia.gas.plaf.jpbc.pairing.a.TypeA1CurveGenerator;
import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeA1CurveGenerator;

// JPBC Type A1 pairing generator...
ParametersGenerator parametersGenerator = new TypeA1CurveGenerator(
3,  // the number of primes
517 // the bit length of each prime
);

// PBC Type A1 pairing generator. No parametrization in this case is possible.
// By default the generator uses two primes of 512 bit length each.
ParametersGenerator pbcPg = new PBCTypeA1CurveGenerator();
```

### Type D

These are ordinary curves with embedding degree 6, whose orders are prime or a prime multiplied by a small constant.

Further information are available here.

For Type D pairing, JPBC provides only the PBC wrapped generator. Here is the code to use it.

```import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeDCurveGenerator;

// Init the generator...
int discriminant = 9563;
ParametersGenerator parametersGenerator = new PBCTypeDParametersGenerator(discriminant);
```

### Type E

The CM (Complex Multiplication) method of constructing elliptic curves starts with the Diophantine equation DV^2=4q-t^3 If t=2 and q=Dr^2h^2+1 for some prime r (which we choose to be a Solinas prime) and some integer h, we find that this equation is easily solved with V = 2rh.

Thus it is easy to find a curve (over the field \mathbb{F}_q. with order q-1. Note r^2. divides q-1. thus we have an embedding degree of 1.

Further information are available here.

For Type E pairing, JPBC provides a ported and a PBC wrapped generator. Here is the code to use them.

```import it.unisa.dia.gas.plaf.jpbc.pairing.e.TypeECurveGenerator;
import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeECurveGenerator;

int rBits = 160;
int qBits = 1024;

// JPBC Type E pairing generator...
ParametersGenerator pg = new TypeECurveGenerator(rBits, qBits);
// PBC Type E pairing generator...
ParametersGenerator pbcPg = new PBCTypeECurveGenerator(rBits, qBits);
```

### Type F

Using carefully crafted polynomials, k = 12 pairings can be constructed. Only 160 bits are needed to represent elements of one group, and 320 bits for the other. Also, embedding degree k = 12 allows higher security short signatures. (k = 6 curves cannot be used to scale security from 160-bits to say 256-bits because finite field attacks are subexponential.)
Discovered by Barreto and Naehrig, "Pairing-friendly elliptic curves of prime order".

Further information are available here.

For Type F pairing, JPBC provides a ported and a PBC wrapped generator. Here is the code to use them.

```import it.unisa.dia.gas.plaf.jpbc.pairing.f.TypeFCurveGenerator;
import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeFCurveGenerator;

int rBits = 160;

// JPBC Type F pairing generator...
ParametersGenerator pg = new TypeFCurveGenerator(rBits);
// PBC Type F pairing generator...
ParametersGenerator pbcPg = new PBCTypeFCurveGenerator(rBits);
```

### Type G

Another construction based on the CM method. Discovered by Freeman, "Constructing pairing-friendly elliptic curves with embedding degree 10."

Further information are available here.

For Type G pairing, JPBC provides only the PBC wrapped generator. Here is the code to use it.

```import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeGCurveGenerator;

// Init the generator...
int discriminant = 35707;
ParametersGenerator parametersGenerator = new PBCTypeGParametersGenerator(discriminant);
```