def testPairing(self): fr1 = Fr() fr1.setByCSPRNG() g1 = G1() g1.setStr(test_data.G1_STR) g2 = G2() g2.setStr(test_data.G2_STR) fr2 = Fr() fr2.setByCSPRNG() gt = GT.pairing(g1 * fr1, g2 * fr2) self.assertIsNotNone(gt)
def testMul(self): self.assertEqual(Fr(20) * Fr(10), Fr(200))
def testSub(self): self.assertEqual(Fr(20) - Fr(10), Fr(10))
def testMul(self): G2() * Fr()
def testSetStr(self): Fr().setStr(b"12345678901234567")
def testInitFr(self): self.assertIsNotNone(Fr())
def testByCSPRNG(self): Fr().setByCSPRNG()
def testGetStr(self): fr = Fr() fr.setStr(b"255") s = fr.getStr() self.assertEqual(b"255", s)