예제 #1
0
    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)
예제 #2
0
 def testMul(self):
     self.assertEqual(Fr(20) * Fr(10), Fr(200))
예제 #3
0
 def testSub(self):
     self.assertEqual(Fr(20) - Fr(10), Fr(10))
예제 #4
0
 def testMul(self):
     G2() * Fr()
예제 #5
0
 def testSetStr(self):
     Fr().setStr(b"12345678901234567")
예제 #6
0
 def testInitFr(self):
     self.assertIsNotNone(Fr())
예제 #7
0
 def testByCSPRNG(self):
     Fr().setByCSPRNG()
예제 #8
0
 def testGetStr(self):
     fr = Fr()
     fr.setStr(b"255")
     s = fr.getStr()
     self.assertEqual(b"255", s)