[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[freehaven-cvs] Add 4 more fun+useful simulations that should hopefu...



Update of /home/freehaven/cvsroot/doc/e2e-traffic/src
In directory moria.mit.edu:/tmp/cvs-serv10812

Modified Files:
	simmain.cpp test.cpp trials.cpp 
Added Files:
	LICENSE PLAN.2 
Log Message:
Add 4 more fun+useful simulations that should hopefully take less time.

--- NEW FILE: LICENSE ---
Traffic analysis simulation code copyright (c) 2003 Nick Mathewson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- NEW FILE: PLAN.2 ---
have:
  case 1:
    b = 1000
    N = 2^6...2^17
    all m

  case 2:
    b = 5
    N = 2^6..2^14
    all m
    all pMA
    all strat

new:
===case 1.1:
3    b = 5, 25, 125
5    N = 32, 256, 4096, 65536, 1048576
4    m = 1,4,16,64
3*5*4 -> 80

  have to discard old case 1 (because b=1000)

===case 2.1/2.2:
3    b = 5, 25, 125
5    N = 32, 256, 4096, 65536, 1048576
4    m = 1,4,16,64
3*5*4 = 80 (but skip b=5, N<65536 cases:: skip 12) -> 68
     pM = .9
     strat = SG

   we can contrast other cases with pMA, strategy, for b=5.

===case 3: timed dyn-pool mix.

    Fix N=65536, m=32, strategy=SG
4   Vary mix alg: pDelay = .1, .3, .6, .9
4   Vary Alice freq: .6, .75, .9, .99
4   Vary background volume: alice*10, alice*100, alice*1000, alice*10000
 -> 64

===case 4: mixnet

    Fix N=65536, m=32, strategy=SG
4   Vary mix alg: pDelay =  .1 .3, .6, .9
3   Vary path length: 2, 4, 8
3   Vary Alice freq: .6, .75, .9, .99
    Fixed background volume based on case 3.
 -> 48

===case 5: impact of dummies

   Fix N,m,strategy as above.
   Fix mix alg pDelay, path length, bg vol based on 4.
     Vary dummy approach, volume, pAbsent

===case 6: impact of partial

   Fix all as in 5.  No dummies.
     Vary pObserve.



Index: simmain.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/simmain.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- simmain.cpp	22 Dec 2003 04:37:34 -0000	1.11
+++ simmain.cpp	8 Jan 2004 03:26:34 -0000	1.12
@@ -53,6 +53,44 @@
   }
 }
 
+void trial1_1()
+{
+  for (int batchSize = 5; batchSize <= 125; batchSize *= 5) {
+    for (int nRecips = 32; nRecips < 2000000; nRecips *= 8) {
+      for (int nAR = 1; (nAR <= 64 && nAR < nRecips); nAR *= 2) {
+	SDTrialSpec s;
+	s.setNRecipients(nRecips);
+	s.setAliceRecipients(nAR);
+	s.setBatchSize(batchSize);
+	if (nRecips > 65536)
+	  s.setCutoff(4000000);
+	else
+	  s.setCutoff(1000000);
+	if (nRecips > 2000)
+	  s.setGranularity(100);
+	else
+	  s.setGranularity(10);
+	int nBad = 0;
+	int nGood = 0;
+	for (int i = 1; i <= 100; ++i) {
+	  s.write(std::cout);
+	  std::cout << "\"" << i << "/" << 100 << "\"" << std::endl;
+	  SDTrial trial(s);
+	  TrialResult res = trial.attempt();
+	  std::cout << res << std::endl << std::endl;
+	  if (res.failed)
+	    ++nBad;
+	  else
+	    ++nGood;
+	  if (nBad >= 5 && nGood < nBad/2) {
+	    break;
+	  }
+	}
+      }
+    }
+  }
+}
+
 void trial2()
 {
   const double pMsgAlice[] = { 0.6, 0.9, 0.99 };
@@ -79,7 +117,7 @@
 	      std::cout << "\"" << i << "/" << 100 << "\"" << std::endl;
 	      UnkBGBatchTrial trial(s);
 	      TrialResult res = trial.attempt();
-	      std::cout << res << std::endl << std::endl; 
+	      std::cout << res << std::endl << std::endl;
 	    }
 	  }
 	}
@@ -88,13 +126,121 @@
   }
 }
 
+void trial2_base(int batchSize, int nRecips)
+{
+  for (int nAR = 1; (nAR <= 64 && nAR < nRecips); nAR *= 2) {
+    UnkBGBatchTrialSpec s;
+    s.setNRecipients(nRecips).setNAliceRecipients(nAR)
+      .setBatchSize(batchSize).setPaddingLevel(0)
+      .setAliceIsSmallworld(1).setWeightAlice(0)
+      .setExpMsgDist(true)
+      .setPMsgAlice(0.9)
+      .setPDummyAlice(0.0);
+    if (nRecips > 2000)
+      s.setGranularity(100);
+    else
+      s.setGranularity(10);
+    if (nRecips > 65536)
+      s.setCutoff(4000000);
+    else
+      s.setCutoff(1000000);
+    int nBad = 0;
+    int nGood = 0;
+    for (int i = 1; i <= 100; ++i) {
+      s.write(std::cout);
+      std::cout << "\"" << i << "/" << 100 << "\"" << std::endl;
+      UnkBGBatchTrial trial(s);
+      TrialResult res = trial.attempt();
+      std::cout << res << std::endl << std::endl; 
+      if (res.failed)
+	++nBad;
+      else
+	++nGood;
+      if (nBad >= 5 && nGood < nBad/2) {
+	break;
+      }
+    }
+  }
+}
+
+void trial2_1()
+{
+  for (int nRecips = 65536; nRecips <= 2000000; nRecips *= 8) {
+    trial2_base(5,nRecips);
+  }
+}
+
+
+void trial2_2()
+{
+  for (int batchSize = 5; batchSize <= 125; batchSize *= 5) {
+    for (int nRecips = 65536; nRecips <= 2000000; nRecips *= 8) {
+      trial2_base(batchSize,nRecips);
+    }
+  }
+}
+
 void trial3()
 {
-  // attack against a dynamic-pool mix.
+  // attack with small-worlds network and unknown background.
+
+  const double pMsgAlice[] = { 0.6, 0.75, 0.9, 0.99 };
+  const double pDelay[] = { .1, .3, .6, .9 };
 
+  for (int pMAi = 0; pMAi <= 3; ++pMAi) {
+    for (int pDi = 0; pDi <= 3; ++pDi) {
+      for (int bg = 32*10; bg <= 32*1000; bg*= 10) {
+	MixTrialSpec s;
+	s.setNRecipients(65536).setNAliceRecipients(32)
+	  .setPathLen(1).setPadding(0)
+	  .setExpAlice(1)
+	  .setPMessage(1.0)
+	  .setPartial(false)
+
+	  .setPDelay(pDelay[pDi])
+	  .setPMessage(pMsgAlice[pMAi])
+	  .setBGVolMean(bg).setBGVolDev(bg/10.0)
+	  .setPObserve(1.0);
+
+	s.setGranularity(50);
+
+	s.setCutoff(1500000);
+	int nBad = 0;
+	int nGood = 0;
+	for (int i = 1; i <= 100; ++i) {
+	  s.write(std::cout);
+	  std::cout << "\"" << i << "/" << 100 << "\"" << std::endl;
+	  MixTrial trial(s);
+	  TrialResult res = trial.attempt();
+	  std::cout << res << std::endl << std::endl; 
+	  if (res.failed)
+	    ++nBad;
+	  else
+	    ++nGood;
+	  if (nBad >= 5 && nGood < nBad/2) {
+	    break;
+	  }
+	}
+      }
+    }
+  }
 }
 
 
+typedef void (*trialfunc)(void);
+
+struct {
+  char *n; trialfunc t;
+} trials[] = {
+  { "1", trial1 },
+  { "1.1", trial1_1 },
+  { "2", trial2 },
+  { "2.1", trial2_1 },
+  { "2.2", trial2_2 },
+  { "3", trial3 },
+  { 0, 0 }
+};
+
 int
 main(int c, char **v)
 {
@@ -106,13 +252,14 @@
 
   std::string trialname(v[1]);
 
-  if (trialname == "1") {
-    trial1();
-  } else if (trialname == "2") {
-    trial2();
-  } else {
-    std::cout << "unrecognized trial name: " << trialname << std::endl;
+  for (int i = 0; trials[i].n; ++i) {
+    if (trialname == trials[i].n) {
+      trials[i].t();
+      return 0;
+    }
   }
 
+  std::cout << "unrecognized trial name: " << trialname << std::endl;
+
   return 0;
 }

Index: test.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/test.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test.cpp	24 Nov 2003 00:33:27 -0000	1.3
+++ test.cpp	8 Jan 2004 03:26:34 -0000	1.4
@@ -15,7 +15,7 @@
 
 vector<int> vec<double>::topN(int n) const;
 
-void 
+void
 test_vec() {
     vec<int> vi1(5);
     vec<int> vi2(5, 7);

Index: trials.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/trials.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- trials.cpp	22 Dec 2003 04:37:34 -0000	1.9
+++ trials.cpp	8 Jan 2004 03:26:34 -0000	1.10
@@ -318,7 +318,7 @@
 
   if (pathLen == 1) {
     delayDist = getSingleMixDelays(pDelay);
-  } else { 
+  } else {
     int md;
     if (pDelay < 0.00001)
       md = pathLen + 1;
@@ -349,7 +349,7 @@
   std::vector<int> *aliceRecipients = 0;
   getCommunicationLinks(aliceRecipDist, backgroundTrafficDist,
                         aliceRecipients,
-                        nAR, nR);
+                        nAR, nR, false, true);
 
   //// set up alice.
   GeometricDist aMsgsE(1.0-pMessage);

***********************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe freehaven-cvs       in the body. http://freehaven.net/