E_FF10_1_SC_2_2.java 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2010 by Yan Huang <yhuang@virginia.edu>
  2. package YaoGC;
  3. import java.math.BigInteger;
  4. import Cipher.Cipher;
  5. import sprout.oram.PID;
  6. import sprout.oram.TID;
  7. class E_FF10_1_SC_2_2 extends FF10_1_SC_2_2 {
  8. public E_FF10_1_SC_2_2() {
  9. super();
  10. }
  11. protected void execYao() {
  12. Wire inWireL = inputWires[0];
  13. Wire inWireR = inputWires[1];
  14. Wire outWire0 = outputWires[0];
  15. Wire outWire1 = outputWires[1];
  16. // receiveGTT();
  17. int i0 = Wire.getLSB(inWireL.lbl);
  18. i0 = inWireL.invd ? (1 - i0) : i0;
  19. int i1 = Wire.getLSB(inWireR.lbl);
  20. i1 = inWireR.invd ? (1 - i1) : i1;
  21. int k0 = outWire0.serialNum;
  22. int k1 = outWire1.serialNum;
  23. timing.stopwatch[PID.sha1][TID.online].start();
  24. BigInteger out = Cipher.decrypt(inWireL.lbl, inWireR.lbl,
  25. k0, k1, gtt[i0][i1]);
  26. timing.stopwatch[PID.sha1][TID.online].stop();
  27. outWire0.setLabel(out.shiftRight(Wire.labelBitLength));
  28. outWire1.setLabel(out.and(Cipher.mask));
  29. }
  30. @Override
  31. protected void passTruthTable() {
  32. receiveGTT();
  33. }
  34. }