Java源码示例:org.apache.milagro.amcl.BLS381.FP12
示例1
@Benchmark
public void ate1x2Mul(Blackhole bh) {
FP12 ate1 = PAIR.ate(signature.getSignature().g2Point().getPoint(), g1Generator.getPoint());
FP12 ate2 = PAIR.ate(signature.getSignature().g2Point().getPoint(), g1Generator.getPoint());
ate1.mul(ate2);
bh.consume(ate1);
}
示例2
@Benchmark
public void ate2(Blackhole bh) {
FP12 ate =
PAIR.ate2(
signature.getSignature().g2Point().getPoint(),
g1Generator.getPoint(),
signature.getSignature().g2Point().getPoint(),
g1Generator.getPoint());
bh.consume(ate);
}
示例3
GTPoint(FP12 point) {
this.point = point;
}
示例4
GTPoint(FP12 point) {
this.point = point;
}
示例5
@Benchmark
public void fexp(Blackhole bh) {
FP12 r = PAIR.fexp(gtPoint);
bh.consume(r);
}
示例6
@Benchmark
public void ate1(Blackhole bh) {
FP12 ate = PAIR.ate(signature.getSignature().g2Point().getPoint(), g1Generator.getPoint());
bh.consume(ate);
}
示例7
public GTPoint(FP12 point) {
this.point = point;
}
示例8
public GTPoint mul(GTPoint other) {
FP12 newPoint = new FP12(other.point);
newPoint.mul(point);
return new GTPoint(newPoint);
}
示例9
public FP12 getPoint() {
return point;
}
示例10
/**
*
* @param p1 the point in Group1, not null
* @param p2 the point in Group2, not null
* @return GTPoint
*/
static GTPoint pair(G1Point p1, G2Point p2) {
FP12 e = PAIR.ate(p2.ecp2Point(), p1.ecpPoint());
return new GTPoint(PAIR.fexp(e));
}
示例11
/**
*
* @param p1 the point in Group1, not null
* @param p2 the point in Group2, not null
* @return GTPoint
*/
static GTPoint pair(G1Point p1, G2Point p2) {
FP12 e = PAIR.ate(p2.ecp2Point(), p1.ecpPoint());
return new GTPoint(PAIR.fexp(e));
}
示例12
/**
* Calculate the Ate pairing of points p and q.
*
* @param p the point in Group1, not null
* @param q the point in Group2, not null
* @return GTPoint
*/
public static GTPoint pair(G1Point p, G2Point q) {
FP12 e = PAIR.ate(q.ecp2Point(), p.ecpPoint());
return new GTPoint(PAIR.fexp(e));
}
示例13
/**
* Calculate the Ate pairing of points p and q but omits the final exponentiation ({@link
* #fexp(GTPoint)}) <code>
* pair() = fexp(pairNoExp())
* </code>
*
* @param p the point in Group1, not null
* @param q the point in Group2, not null
* @return GTPoint
*/
public static GTPoint pairNoExp(G1Point p, G2Point q) {
FP12 e = PAIR.ate(q.ecp2Point(), p.ecpPoint());
return new GTPoint(e);
}
示例14
/**
* Calculates the product of pairings while performing the final exponentiation only once. This
* ought to be more efficient.
*
* <p>If pair(-p, q) == pair(r, s) then the result of this is "one" in GT.
*
* @param p a point in Group1, not null
* @param q a point in Group2, not null
* @param r a point in Group1, not null
* @param s a point in Group2, not null
* @return The result of the double pairing
*/
static GTPoint pair2(G1Point p, G2Point q, G1Point r, G2Point s) {
FP12 e = PAIR.ate2(q.ecp2Point(), p.ecpPoint(), s.ecp2Point(), r.ecpPoint());
return new GTPoint(PAIR.fexp(e));
}
示例15
/**
* The same as {@link #pair2(G1Point, G2Point, G1Point, G2Point)} but omits the final
* exponentiation ({@link #fexp(GTPoint)}) <code>
* pair2() = fexp(pair2NoExp())
* </code>
*/
static GTPoint pair2NoExp(G1Point p, G2Point q, G1Point r, G2Point s) {
FP12 e = PAIR.ate2(q.ecp2Point(), p.ecpPoint(), s.ecp2Point(), r.ecpPoint());
return new GTPoint(e);
}