public class BLS12_381PairingTest
extends junit.framework.TestCase
Without external KAT vectors at hand, these tests validate the pairing via its defining algebraic properties:
e(O, Q) == 1 and e(P, O) == 1.e(G1, G2) != 1.e(P, Q)^r == 1 (output is in GT, the
order-r subgroup of Fp^12).e(a*P, Q) == e(P, Q)^a.e(P, b*Q) == e(P, Q)^b.e(a*P, b*Q) == e(P, Q)^(a*b).e(a*P, Q) == e(P, a*Q).| Constructor and Description |
|---|
BLS12_381PairingTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testBilinearityInG1() |
void |
testBilinearityInG2() |
void |
testFullBilinearity() |
void |
testGtSubgroupMembership() |
void |
testHardPartMatchesNaiveModPow()
Confirms the Hayashida-Hayasaka-Teruya
/3 hard-part chain
produces the canonical f^((p^4 - p^2 + 1) / r) (no cube
factor), by direct comparison against a naive
Fp12Element.modPow(java.math.BigInteger) on the full hard exponent. |
void |
testIdentityG1() |
void |
testIdentityG2() |
void |
testMultiPairAllInfinityReturnsOne() |
void |
testMultiPairMixedInfinitySkips() |
void |
testMultiPairRejectsLengthMismatch() |
void |
testNonDegeneracy() |
void |
testScalarSwap() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic void testIdentityG1()
public void testIdentityG2()
public void testNonDegeneracy()
public void testGtSubgroupMembership()
public void testHardPartMatchesNaiveModPow()
/3 hard-part chain
produces the canonical f^((p^4 - p^2 + 1) / r) (no cube
factor), by direct comparison against a naive
Fp12Element.modPow(java.math.BigInteger) on the full hard exponent. Catches any
algebra error in the chain that would otherwise hide behind
bilinearity (which holds even when the pairing differs from
canonical by a fixed power coprime to r).public void testBilinearityInG1()
public void testBilinearityInG2()
public void testFullBilinearity()
public void testScalarSwap()
public void testMultiPairRejectsLengthMismatch()
public void testMultiPairAllInfinityReturnsOne()
public void testMultiPairMixedInfinitySkips()