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

[freehaven-cvs] Code for sims for case 7: pseudonyms



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

Modified Files:
	PLAN.5 netparams.cpp netparams.h simmain.cpp trials.cpp 
	trials.h 
Log Message:
Code for sims for case 7: pseudonyms

Index: PLAN.5
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/PLAN.5,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PLAN.5	11 Apr 2004 01:17:01 -0000	1.3
+++ PLAN.5	11 Apr 2004 05:02:56 -0000	1.4
@@ -6,7 +6,9 @@
 
 New cases for preproceedings:
 
-   5c: N=65536, nAlice=32, bgVol=125,
+5c: Perfect padding, imperfectly realized.
+
+ N=65536, nAlice=32, bgVol=125,
    pMsgAlice = 0.6
 
    padding = 2,4                 [2]
@@ -36,7 +38,9 @@
     5c.8: totoro:    A: 0.0 B:0.97 C:1.64 D:2.70
 
 
-   5d: N=65536, nAlice=2,8,32,128 bgVol=125
+5d: Perfect padding with previous nonmembership
+
+    N=65536, nAlice=2,8,32,128 bgVol=125
     padding=2 smoothing=yes
     pDelay = .1, .6, .9
     pathlen = 1, 4
@@ -50,3 +54,23 @@
    5d.1: impulse   E:0.0
    5d.2: borel:    E:0.0
    5d.3: lebesgue: E:0.0
+
+7a: Pseudonyms
+
+   Alice sends with P1; (N-1) others send to pseudonyms P2...PN.
+   All pseudonymous users other than Alice send with equal frequency.
+
+   N=1024,4096,16384,65536,232144
+   pDelay = .1,.6,.9
+   pathlen=1,4
+   pM = .1,.6
+   bgVol=128,1024,8192,65536 (but less than N)
+
+   7a.1 pDelay=.1, pathlen=1
+   7a.2 pDelay=.6, pathlen=1
+   7a.3 pDelay=.9, pathlen=1
+   7a.4 pDelay=.1, pathlen=4
+   7a.5 pDelay=.6, pathlen=4
+   7a.6 pDelay=.9, pathlen=4
+
+        

Index: netparams.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/netparams.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- netparams.cpp	22 Dec 2003 03:58:20 -0000	1.7
+++ netparams.cpp	11 Apr 2004 05:02:56 -0000	1.8
@@ -127,3 +127,37 @@
   // XXX is too small.
   aliceRecipDist = new OCumulativeDist(pAlice);
 }
+
+
+
+void
+getNymStats(InvDist<int> *&aliceNymDist,
+	    InvDist<int> *&backgroundNymDist,
+	    std::vector<int> *&aliceNyms,
+	    int nAliceNyms,
+	    int nNyms,
+	    bool smallworld)
+{
+  assert(nAliceNyms<nNyms);
+  int nBGNyms = nNyms-nAliceNyms;
+  std::vector<int> a(nNyms,0);
+  aliceNyms = new std::vector<int>(nAliceNyms);
+  for (int i=0; i<nAliceNyms; ++i) {
+    a[nBGNyms+i]=1;
+    (*aliceNyms)[i]=nBGNyms+i;
+  }
+  aliceNymDist = new OCumulativeDist(a);
+  if (!smallworld) {
+    std::vector<int> b(nNyms,0);
+    for (int i=0; i < (nNyms-nAliceNyms); ++i) {
+      b[i]=1;
+    }
+    backgroundNymDist = new OCumulativeDist(b);
+  } else {
+    InvDist<int> *ad, *bd;
+    std::vector<int> *ar;
+    getCommunicationLinks(ad,bd,ar,1,nNyms-nAliceNyms,false,false);
+    delete ar, ad;
+    backgroundNymDist = bd;
+  }
+}

Index: netparams.h
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/netparams.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- netparams.h	22 Dec 2003 03:58:20 -0000	1.3
+++ netparams.h	11 Apr 2004 05:02:56 -0000	1.4
@@ -53,6 +53,12 @@
                            bool weightAlice=0,
 			   bool smallworldAlice=0);
 
-
+void
+getNymStats(InvDist<int> *&aliceNymDist,
+	    InvDist<int> *&backgroundNymDist,
+	    std::vector<int> *&aliceNyms,
+	    int nAliceNyms,
+	    int nNyms,
+	    bool smallworld);
 
 #endif // _NETPARAMS_H

Index: simmain.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/simmain.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- simmain.cpp	11 Apr 2004 01:17:01 -0000	1.36
+++ simmain.cpp	11 Apr 2004 05:02:56 -0000	1.37
@@ -1392,6 +1392,80 @@
   trial6_base(.1,.05);
 }
 
+
+void trial7_base(int N, double pDelay, int pathLen, double pMsg, int bgvol)
+{
+  MixTrialSpec s;
+
+  s.setNRecipients(N).setNAliceRecipients(1)
+    .setPathLen(pathLen)
+    .setExpAlice(1)
+    .setPartial(false)
+    .setPOnline(1.0)
+    .setPDelay(pDelay)
+    .setPMessage(pMsg)
+    .setBGVolMean(bgvol).setBGVolDev(bgvol/10.0)
+    .setPObserve(1.0)
+    .setPDummy(0.0);
+
+  s.setGranularity(10);
+
+  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;
+    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;
+    }
+  }
+}
+
+void trial7a_base(double pDelay, int pathLen)
+{
+  for (int N=1024; N <=232144; N *= 4) {
+    for (int bg=128; bg <= N; bg *= 8) {
+      for (int pM =1; pM <= 6; pM += 5) {
+	trial7_base(N,pDelay,pathLen,pM/10.0,bg);
+      }
+    }
+  }
+}
+
+void trial7a_1()
+{
+  trial7a_base(.1,1);
+}
+void trial7a_2()
+{
+  trial7a_base(.6,1);
+}
+void trial7a_3()
+{
+  trial7a_base(.9,1);
+}
+void trial7a_4()
+{
+  trial7a_base(.1,4);
+}
+void trial7a_5()
+{
+  trial7a_base(.6,4);
+}
+void trial7a_6()
+{
+  trial7a_base(.9,4);
+}
+
+
 typedef void (*trialfunc)(void);
 
 struct {
@@ -1507,6 +1581,13 @@
   { "6.10.1",   trial6_10_1 },
   { "6.10.2",   trial6_10_2 },
 
+  { "7a.1", trial7a_1 },
+  { "7a.2", trial7a_2 },
+  { "7a.3", trial7a_3 },
+  { "7a.4", trial7a_4 },
+  { "7a.5", trial7a_5 },
+  { "7a.6", trial7a_6 },
+
   { 0, 0 }
 };
 

Index: trials.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/trials.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- trials.cpp	11 Apr 2004 01:17:01 -0000	1.17
+++ trials.cpp	11 Apr 2004 05:02:56 -0000	1.18
@@ -322,7 +322,7 @@
 	       double bgVolMean, double bgVolDev,
 	       double pOnline, int padding, bool smoothPadding,
 	       int g, bool partial, double pObserve, int c,
-	       bool knownBackground)
+	       bool knownBackground, bool pseudonyms)
 {
   assert(pathLen > 0);
 
@@ -363,9 +363,14 @@
   InvDist<int> *aliceRecipDist = 0;
   InvDist<int> *backgroundTrafficDist = 0;
   std::vector<int> *aliceRecipients = 0;
-  getCommunicationLinks(aliceRecipDist, backgroundTrafficDist,
-                        aliceRecipients,
-                        nAR, nR, false, true);
+  if (!pseudonyms) {
+    getCommunicationLinks(aliceRecipDist, backgroundTrafficDist,
+			  aliceRecipients,
+			  nAR, nR, false, true);
+  } else {
+    getNymStats(aliceRecipDist, backgroundTrafficDist,
+		aliceRecipients, nAR, nR, false);
+  }
 
   //// Set up attacker and mixnet
   mixnet = new DelayMix(nR, maxDelay, delayDist);

Index: trials.h
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/trials.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- trials.h	11 Apr 2004 01:17:01 -0000	1.11
+++ trials.h	11 Apr 2004 05:02:56 -0000	1.12
@@ -217,6 +217,7 @@
  protected:
   int nRecipients, nAliceRecipients, pathLen, padding, granularity, cutoff;
   bool expAlice, partial, ea_set, p_set, smoothPadding, knownBackground;
+  bool pseudonyms;
   double pOnline, pDelay, pMessage, pDummy, bgVolMean, bgVolDev, pObserve;
  public:
   MixTrialSpec() {
@@ -226,7 +227,7 @@
     nRecipients = nAliceRecipients = pathLen = 0;
     ea_set = p_set = smoothPadding = false;
     pDelay = pMessage = pDummy = bgVolMean = bgVolDev = -1;
-    knownBackground = false;
+    knownBackground = pseudonyms = false;
   }
   MixTrialSpec &setNRecipients(int n) { nRecipients = n; return *this; }
   MixTrialSpec &setNAliceRecipients(int n) { nAliceRecipients = n; return *this; }
@@ -248,6 +249,7 @@
   MixTrialSpec &setPObserve(double d) { pObserve = d; return *this; }
   MixTrialSpec &setPOnline(double d) { pOnline = d; return *this; }
   MixTrialSpec &setKnownBackground(bool b) { knownBackground = b; return *this; }
+  MixTrialSpec &setPseudonyms(bool b) { pseudonyms = b;  return *this; }
 
   void assertFilled() const {
     assert(nRecipients && nAliceRecipients && pathLen);
@@ -282,7 +284,8 @@
 	    bool partial,
 	    double pObserve,
 	    int cutoff,
-	    bool knownBackground
+	    bool knownBackground,
+	    bool pseudonyms
 	    );
  public:
   MixTrial(const MixTrialSpec &s) : NonbatchTrial(s.nRecipients, s.granularity)
@@ -290,7 +293,8 @@
       init(s.nRecipients, s.nAliceRecipients, s.pathLen, s.pDelay,
 	   s.expAlice, s.pMessage, s.pDummy, s.bgVolMean, s.bgVolDev,
 	   s.pOnline, s.padding, s.smoothPadding,
-	   s.granularity, s.partial, s.pObserve, s.cutoff, s.knownBackground); }
+	   s.granularity, s.partial, s.pObserve, s.cutoff, s.knownBackground,
+	   s.pseudonyms); }
   TrialResult attempt();
   ~MixTrial() {}
 };

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