Commit 100fd683abc0bc0efd0bc7c795790ce7803b1228

TESTS: ironed out one of the last kinks in the proof for KSW
KSW.py
(30 / 2)
  
247247 result += part1*part2
248248 assert(result == 1)
249249 # work backwards another step
250
251
250 # build R0
251 R0 = g_G_r**Element.random(pairing, Zr)
252 # build Q
253 Q = g_G_q * R0
254 # build R5
255 R5 = g_G_r**Element.random(pairing, Zr)
256 # build Q6
257 Q6 = g_G_q**Element.random(pairing, Zr)
258 # build the R vector
259 Rv = [(g_G_r**Element.random(pairing, Zr), g_G_r**Element.random(pairing, Zr)) for i in range(3)]
260 # build the H vector
261 Hv = []
262 for i in range(3):
263 Hv.append((hv[i][0] * Rv[i][0], hv[i][1] * Rv[i][1]))
264 # build the initial pairing value
265 product = Element.one(pairing, G1)
266 for pos, i in enumerate(hv):
267 h1, h2 = i
268 r1, r2 = rv[pos]
269 product *= (h1**-r1)*(h2**-r2)
270 # get the initial result
271 result = pairing.apply(g_G_p**s, R5*Q6*product)
272 for pos, i in enumerate(Hv):
273 H1, H2 = i
274 R3, R4 = Rv[pos]
275 r1, r2 = rv[pos]
276 part1 = pairing.apply((H1**s)*(Q**(a*Xv[pos])*R3), (g_G_p**r1)*(g_G_q**(f1*Pv[pos])))
277 part2 = pairing.apply((H2**s)*(Q**(b*Xv[pos])*R4), (g_G_p**r2)*(g_G_q**(f2*Pv[pos])))
278 result *= part1*part2
279 print(result)
252280
253281if __name__ == "__main__":
254282 test()