a little optimization of rerandomize

dev
MITSUNARI Shigeo 8 years ago
parent af65817bf8
commit 8d6a314c4a
  1. 14
      include/mcl/bgn.hpp

@ -355,24 +355,22 @@ struct BGNT {
/*
add Enc(0) * Enc(0)
(S1, T1) * (S2, T2) = (rP, rxP) * (r'Q, r'xQ)
replace r <- rr'
= (r P, rxP) * (Q, xQ)
*/
G1 S1, T1;
G2 S2, T2;
Fr r;
r.setRand(rg);
G1::mul(S1, P, r);
G1::mul(T1, xP, r);
r.setRand(rg);
G2::mul(S2, Q, r);
G2::mul(T2, xQ, r);
GT e;
BN::millerLoop(e, S1, S2);
BN::millerLoop(e, S1, Q);
c.g[0] *= e;
BN::millerLoop(e, S1, T2);
BN::millerLoop(e, S1, xQ);
c.g[1] *= e;
BN::millerLoop(e, T1, S2);
BN::millerLoop(e, T1, Q);
c.g[2] *= e;
BN::millerLoop(e, T1, T2);
BN::millerLoop(e, T1, xQ);
c.g[3] *= e;
} else {
CipherText c0;

Loading…
Cancel
Save