TestGarbler.java 725 B

12345678910111213141516171819202122232425262728293031323334
  1. package com.oblivm.backend.gc.offline;
  2. import java.security.SecureRandom;
  3. import org.junit.Test;
  4. import com.oblivm.backend.gc.GCSignal;
  5. public class TestGarbler {
  6. SecureRandom rnd = new SecureRandom();
  7. GCSignal a = GCSignal.freshLabel(rnd);
  8. GCSignal b = GCSignal.freshLabel(rnd);
  9. GCSignal m = GCSignal.freshLabel(rnd);
  10. Garbler gb = new Garbler();
  11. public void test() {
  12. gb.enc(a, b, 0, m);
  13. }
  14. @Test
  15. public void test1000() {
  16. double t1 = System.nanoTime();
  17. int len = 1000000;
  18. for (int i = 0; i < len; i++)
  19. test();
  20. double t2 = System.nanoTime();
  21. System.out.println(len / (t2 - t1) * 1000000000.0);
  22. }
  23. public static void main(String[] args) {
  24. TestGarbler a = new TestGarbler();
  25. a.test1000();
  26. }
  27. }