changeset 146:ccc732a27881

Really add the VIFF 0.6 HTML documentation!
author Martin Geisler <mg@daimi.au.dk>
date Wed, 28 May 2008 19:30:53 +0200
parents 2ce465e725a9
children 7b2038257f35
files doc/0.6/authors.html doc/0.6/bibliography.html doc/0.6/coding-style.html doc/0.6/comparison.html doc/0.6/config.html doc/0.6/development.html doc/0.6/field.html doc/0.6/genindex.html doc/0.6/glossary.html doc/0.6/implementation.html doc/0.6/index.html doc/0.6/install.html doc/0.6/matrix.html doc/0.6/modindex.html doc/0.6/overview.html doc/0.6/presentations.html doc/0.6/program-counters.html doc/0.6/prss.html doc/0.6/runtime.html doc/0.6/search.html doc/0.6/shamir.html doc/0.6/unit-testing.html doc/0.6/util.html
diffstat 23 files changed, 4492 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/authors.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,95 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>VIFF Development Team &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Glossary" href="glossary.html" />
+    <link rel="prev" title="Bibliography" href="bibliography.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="glossary.html" title="Glossary" accesskey="N">next</a> |</li>
+          <li class="right"><a href="bibliography.html" title="Bibliography" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="viff-development-team">VIFF Development Team<a class="headerlink" href="#viff-development-team" title="Permalink to this headline">¶</a></h1>
+<p>The following people have contributed to VIFF (ordered by first commit
+to the repository):</p>
+<ul class="simple">
+<li>Martin Geisler &lt;<a class="reference" href="mailto:mg&#37;&#52;&#48;daimi&#46;au&#46;dk">mg<span>&#64;</span>daimi<span>&#46;</span>au<span>&#46;</span>dk</a>&gt;</li>
+<li>Tomas Toft</li>
+<li>Mikkel Krøigård &lt;<a class="reference" href="mailto:mk&#37;&#52;&#48;daimi&#46;au&#46;dk">mk<span>&#64;</span>daimi<span>&#46;</span>au<span>&#46;</span>dk</a>&gt;</li>
+<li>Thomas Pelle Jakobsen &lt;<a class="reference" href="mailto:mas&#37;&#52;&#48;daimi&#46;au&#46;dk">mas<span>&#64;</span>daimi<span>&#46;</span>au<span>&#46;</span>dk</a>&gt;</li>
+<li>Jakob Illeborg Pagter</li>
+</ul>
+<p>If you have been forgotten, then please checkout <a class="reference" href="http://hg.viff.dk/viff/">the repository</a>,
+add yourself to the list and <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">send us a patch</a>!</p>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="bibliography.html" title="previous chapter">Bibliography</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="glossary.html" title="next chapter">Glossary</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/authors.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="glossary.html" title="Glossary" accesskey="N">next</a> |</li>
+          <li class="right"><a href="bibliography.html" title="Bibliography" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/bibliography.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,160 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Bibliography &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="VIFF Development Team" href="authors.html" />
+    <link rel="prev" title="Implementation" href="implementation.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="authors.html" title="VIFF Development Team" accesskey="N">next</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="bibliography">Bibliography<a class="headerlink" href="#bibliography" title="Permalink to this headline">¶</a></h1>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">This list is far from complete. If you find more relevant
+references then please <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">send us a mail</a> with the information.</p>
+</div>
+<p>The algorighms used by VIFF are published in various academic papers.
+Here we will try to point out which parts of the code uses which
+papers.</p>
+<ul class="simple">
+<li>The <tt class="docutils literal"><span class="pre">viff.shamir</span></tt> module is obviously based on <a class="citation-reference" href="#shamir79" id="id2" name="id2">[Shamir79]</a>.</li>
+<li><tt class="docutils literal"><span class="pre">apps/millionaires.py</span></tt>: Inspired by <a class="citation-reference" href="#yao82" id="id3" name="id3">[Yao82]</a>.</li>
+<li>The default comparison operation (<tt class="docutils literal"><span class="pre">Runtime.greater_than_equal</span></tt>) is
+based on the comparison protocol from <a class="citation-reference" href="#toft05" id="id4" name="id4">[Toft05]</a>.</li>
+<li>Broadcast (<tt class="docutils literal"><span class="pre">Runtime.broadcast</span></tt>) is based on the original paper by
+<a class="citation-reference" href="#bracha84" id="id5" name="id5">[Bracha84]</a> and on the explanation by <a class="citation-reference" href="#cachin05" id="id6" name="id6">[Cachin05]</a>.</li>
+<li>The pseudo-random secret sharing (PRSS) in <tt class="docutils literal"><span class="pre">viff.prss</span></tt> is
+described in <a class="citation-reference" href="#cdi05" id="id7" name="id7">[CDI05]</a>. The
+<a title="viff.runtime.Runtime.prss_share_bit_double" class="reference" href="runtime.html#viff.runtime.Runtime.prss_share_bit_double"><tt class="xref docutils literal"><span class="pre">viff.runtime.Runtime.prss_share_bit_double()</span></tt></a> method uses a
+protocol described in <a class="citation-reference" href="#damg-rd08" id="id8" name="id8">[Damgård08]</a>.</li>
+</ul>
+<table class="docutils citation" frame="void" id="bracha84" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id5" name="bracha84">[Bracha84]</a></td><td>G. Bracha, <em>An asynchronous [(n-1)/3]-resilient
+consensus protocol</em>, Proc 3rd ACM Symposium on Principles of
+Distributed Computing (PODC), 1984, 154-162.</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="cachin05" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id6" name="cachin05">[Cachin05]</a></td><td><p class="first">Christian Cachin, <em>Security and Fault-tolerance in
+Distributed Systems</em>, ETHZ, 2005, <a class="reference" href="http://www.zurich.ibm.com/~cca/sft05/agreement.pdf">PDF</a>.</p>
+</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="cdi05" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id7" name="cdi05">[CDI05]</a></td><td><p class="first">Ronald Cramer, Ivan Damgård, and Yuval Ishai, <em>Share
+Conversion, Pseudorandom Secret-Sharing and Applications to Secure
+Computation</em>, Proc of TCC 2005, LNCS 3378, <a class="reference" href="http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps">PS</a>.</p>
+</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="damg-rd08" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id8" name="damg-rd08">[Damgård08]</a></td><td><p class="first">Ivan Damgård and Rune Thorbek, <em>Efficient Conversion of
+Secret-shared Values Between Different Fields</em>, Cryptology ePrint
+Archive: <a class="reference" href="http://eprint.iacr.org/2008/221">Report 2008/221</a>.</p>
+</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="shamir79" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id2" name="shamir79">[Shamir79]</a></td><td>Adi Shamir, <em>How to share a secret</em>, Communications of
+the ACM, 22 (11): 612-613.</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="toft05" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id4" name="toft05">[Toft05]</a></td><td><p class="first">Tomas Toft, <em>Secure Integer Computation with Applications
+in Economics</em>, PhD Progress Report, July 2005, <a class="reference" href="http://www.daimi.au.dk/~tomas/publications/progress.pdf">PDF</a>.</p>
+</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="yao82" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id3" name="yao82">[Yao82]</a></td><td>Andrew Chi-Chih Yao, <em>Protocols for Secure Computations</em>,
+FOCS 1982, 160-164.</td></tr>
+</tbody>
+</table>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="implementation.html" title="previous chapter">Implementation</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="authors.html" title="next chapter">VIFF Development Team</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/bibliography.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="authors.html" title="VIFF Development Team" accesskey="N">next</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/coding-style.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,128 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Coding Style &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Developer&#8217;s Guide" href="development.html" />
+    <link rel="prev" title="Program Counters" href="program-counters.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="development.html" title="Developer&#8217;s Guide" accesskey="N">next</a> |</li>
+          <li class="right"><a href="program-counters.html" title="Program Counters" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="coding-style">Coding Style<a class="headerlink" href="#coding-style" title="Permalink to this headline">¶</a></h1>
+<p>The VIFF code tries to follow the coding style laid out in <a class="reference" href="http://www.python.org/dev/peps/pep-0008">PEP 8</a>,
+which you should read or at least skim over. You can check your code
+against by running the <a class="reference" href="http://svn.browsershots.org/trunk/devtools/pep8/pep8.py">pep8.py</a> checker.</p>
+<div class="section">
+<h2 id="the-viff-coding-style-in-short">The VIFF Coding Style in Short<a class="headerlink" href="#the-viff-coding-style-in-short" title="Permalink to this headline">¶</a></h2>
+<p>A summary of the rules:</p>
+<ul class="simple">
+<li>Use four spaces for indention, never tabs.</li>
+<li>Use a single space around binary operators.</li>
+<li>Name classes using <tt class="docutils literal"><span class="pre">CamelCase</span></tt>.</li>
+<li>Name variables, function, and methods using lowercase words like
+<tt class="docutils literal"><span class="pre">foo_bar</span></tt>.</li>
+<li>Write docstrings for your functions and methods. Include test for
+<a class="reference" href="http://docs.python.org/lib/module-doctest.html">doctest</a> if possible.</li>
+<li>Try to be consistent.</li>
+</ul>
+<p>These rules are there to make the source code more readable for both
+old and new people.</p>
+</div>
+<div class="section">
+<h2 id="the-twisted-coding-style">The Twisted Coding Style<a class="headerlink" href="#the-twisted-coding-style" title="Permalink to this headline">¶</a></h2>
+<p>VIFF uses <a class="reference" href="http://twistedmatrix.com/">Twisted</a> and their code follows a slightly different coding
+style. Their style is closer to the style used in Java where functions
+and methods are named <tt class="docutils literal"><span class="pre">fooBar</span></tt> instead of <tt class="docutils literal"><span class="pre">foo_bar</span></tt>.</p>
+<p>When writing code which is close to Twisted code, you might want to
+follow that style too. If you subclass a Twisted class to override
+some behavior, you might be forced to follow their style.</p>
+<p>If you have a choice, then you should only use the Twisted style if
+you expect people to call both your code and the Twisted code — if
+people will only call your code, then please follow the standard VIFF
+coding style.</p>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Coding Style</a><ul>
+<li><a class="reference" href="#the-viff-coding-style-in-short">The VIFF Coding Style in Short</a></li>
+<li><a class="reference" href="#the-twisted-coding-style">The Twisted Coding Style</a></li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="program-counters.html" title="previous chapter">Program Counters</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="development.html" title="next chapter">Developer&#8217;s Guide</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/coding-style.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="development.html" title="Developer&#8217;s Guide" accesskey="N">next</a> |</li>
+          <li class="right"><a href="program-counters.html" title="Program Counters" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/comparison.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Comparison protocols &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="PRSS Module" href="prss.html" />
+    <link rel="prev" title="Runtime Module" href="runtime.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="prss.html" title="PRSS Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="runtime.html" title="Runtime Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="comparison-protocols">Comparison protocols<a class="headerlink" href="#comparison-protocols" title="Permalink to this headline">¶</a></h1>
+<p>Two comparison protocols have been implemented in VIFF. They are
+available in the classes <a title="ComparisonToft05Mixin" class="reference" href="#ComparisonToft05Mixin"><tt class="xref docutils literal"><span class="pre">ComparisonToft05Mixin</span></tt></a> and
+<a title="ComparisonToft07Mixin" class="reference" href="#ComparisonToft07Mixin"><tt class="xref docutils literal"><span class="pre">ComparisonToft07Mixin</span></tt></a>. Both protocols have been designed by
+Tomas Toft.</p>
+<p>The classes are <em>mixin</em> classes which means that they are meant to be
+used (&#8220;mixed&#8221;) with other classes to build a finished usable class.
+Two standard &#8220;flavors&#8221; are provided in the <a title="Toft05Runtime" class="reference" href="#Toft05Runtime"><tt class="xref docutils literal"><span class="pre">Toft05Runtime</span></tt></a> and
+<a title="Toft07Runtime" class="reference" href="#Toft07Runtime"><tt class="xref docutils literal"><span class="pre">Toft07Runtime</span></tt></a>.</p>
+<dl class="class">
+<dt id="ComparisonToft05Mixin">
+<!--#ComparisonToft05Mixin#-->class <tt class="descname">ComparisonToft05Mixin</tt><a class="headerlink" href="#ComparisonToft05Mixin" title="Permalink to this definition">¶</a></dt>
+<dd><p>Comparison by Tomas Toft, 2005.</p>
+<dl class="method">
+<dt id="ComparisonToft05Mixin.greater_than_equal">
+<!--#ComparisonToft05Mixin.greater_than_equal#--><tt class="descname">greater_than_equal</tt><big>(</big><em>share_a</em>, <em>share_b</em><big>)</big><a class="headerlink" href="#ComparisonToft05Mixin.greater_than_equal" title="Permalink to this definition">¶</a></dt>
+<dd><p>Compute <tt class="docutils literal"><span class="pre">share_a</span> <span class="pre">&gt;=</span> <span class="pre">share_b</span></tt>.</p>
+<p>Both arguments must be from the same field. The result is a
+<a title="viff.field.GF256" class="reference" href="field.html#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">GF256</span></tt></a> share.</p>
+<div class="admonition warning">
+<p class="first admonition-title">Caveat</p>
+<p class="last">The result type (<a title="viff.field.GF256" class="reference" href="field.html#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">viff.field.GF256</span></tt></a>) is different
+from the argument types (general field elements).</p>
+</div>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="Toft05Runtime">
+<!--#Toft05Runtime#-->class <tt class="descname">Toft05Runtime</tt><big>(</big><em>player</em>, <em>threshold</em>, <em>options=None</em><big>)</big><a class="headerlink" href="#Toft05Runtime" title="Permalink to this definition">¶</a></dt>
+<dd>Default mix of <a title="ComparisonToft05Mixin" class="reference" href="#ComparisonToft05Mixin"><tt class="xref docutils literal"><span class="pre">ComparisonToft05Mixin</span></tt></a> and
+<a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a>.</dd></dl>
+
+<dl class="class">
+<dt id="ComparisonToft07Mixin">
+<!--#ComparisonToft07Mixin#-->class <tt class="descname">ComparisonToft07Mixin</tt><a class="headerlink" href="#ComparisonToft07Mixin" title="Permalink to this definition">¶</a></dt>
+<dd><p>Efficient comparison by Tomas Toft 2007. This mixin provides a
+<tt class="xref docutils literal"><span class="pre">greater_than_equal()</span></tt> method which can compare Zp field
+elements and gives a secret result shared over Zp.</p>
+<dl class="method">
+<dt id="ComparisonToft07Mixin.greater_than_equal">
+<!--#ComparisonToft07Mixin.greater_than_equal#--><tt class="descname">greater_than_equal</tt><big>(</big><em>share_a</em>, <em>share_b</em><big>)</big><a class="headerlink" href="#ComparisonToft07Mixin.greater_than_equal" title="Permalink to this definition">¶</a></dt>
+<dd><p>Compute <tt class="docutils literal"><span class="pre">share_a</span> <span class="pre">&gt;=</span> <span class="pre">share_b</span></tt>.</p>
+<p>Both arguments must be shares from the same field. The result
+is a new 0/1 share from the field.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="Toft07Runtime">
+<!--#Toft07Runtime#-->class <tt class="descname">Toft07Runtime</tt><big>(</big><em>player</em>, <em>threshold</em>, <em>options=None</em><big>)</big><a class="headerlink" href="#Toft07Runtime" title="Permalink to this definition">¶</a></dt>
+<dd>Default mix of <a title="ComparisonToft07Mixin" class="reference" href="#ComparisonToft07Mixin"><tt class="xref docutils literal"><span class="pre">ComparisonToft07Mixin</span></tt></a> and
+<a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a>.</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="runtime.html" title="previous chapter">Runtime Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="prss.html" title="next chapter">PRSS Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/comparison.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="prss.html" title="PRSS Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="runtime.html" title="Runtime Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/config.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,159 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Config Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Program Counters" href="program-counters.html" />
+    <link rel="prev" title="PRSS Module" href="prss.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="program-counters.html" title="Program Counters" accesskey="N">next</a> |</li>
+          <li class="right"><a href="prss.html" title="PRSS Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.config">Config Module<a class="headerlink" href="#module-viff.config" title="Permalink to this headline">¶</a></h1>
+<p>Functions for loading and saving player configurations. Each player
+participating in a protocol execution must know some information about
+the other players, namely their hostname and port number. The player
+also needs to know something about itself, namely the keys used for
+pseudo-random secret sharing (PRSS).</p>
+<p>The <a title="viff.config.Player" class="reference" href="#viff.config.Player"><tt class="xref docutils literal"><span class="pre">Player</span></tt></a> class encapsulates this information. Generating a
+player configuration is done using the <a title="viff.config.generate_configs" class="reference" href="#viff.config.generate_configs"><tt class="xref docutils literal"><span class="pre">generate_configs()</span></tt></a>
+function. The <tt class="docutils literal"><span class="pre">generate_config_files.py</span></tt> script uses that
+function to generate a player config and save it in a number of
+<tt class="docutils literal"><span class="pre">.ini</span></tt> files. Such a <tt class="docutils literal"><span class="pre">.ini</span></tt> file can be loaded with the
+<a title="viff.config.load_config" class="reference" href="#viff.config.load_config"><tt class="xref docutils literal"><span class="pre">load_config()</span></tt></a> function.</p>
+<dl class="class">
+<dt id="viff.config.Player">
+<!--#viff.config.Player#-->class <tt class="descclassname">viff.config.</tt><tt class="descname">Player</tt><big>(</big><em>id</em>, <em>host</em>, <em>port</em>, <em>keys=None</em>, <em>dealer_keys=None</em><big>)</big><a class="headerlink" href="#viff.config.Player" title="Permalink to this definition">¶</a></dt>
+<dd><p>Wrapper for information about a player in the protocol.</p>
+<dl class="attribute">
+<dt id="viff.config.Player.id">
+<!--#viff.config.Player.id#--><tt class="descname">id</tt><a class="headerlink" href="#viff.config.Player.id" title="Permalink to this definition">¶</a></dt>
+<dt id="viff.config.Player.host">
+<tt class="descname">host</tt><a class="headerlink" href="#viff.config.Player.host" title="Permalink to this definition">¶</a></dt>
+<dt id="viff.config.Player.port">
+<tt class="descname">port</tt><a class="headerlink" href="#viff.config.Player.port" title="Permalink to this definition">¶</a></dt>
+<dd>ID, hostname, and portnumber of the player.</dd></dl>
+
+<dl class="method">
+<dt id="viff.config.Player.prfs">
+<!--#viff.config.Player.prfs#--><tt class="descname">prfs</tt><big>(</big><em>modulus</em><big>)</big><a class="headerlink" href="#viff.config.Player.prfs" title="Permalink to this definition">¶</a></dt>
+<dd><p>Retrieve PRSS PRFs.</p>
+<p>The pseudo-random functions are used when this player is part
+of a pseudo-random secret sharing for sharing an element
+random to all players.</p>
+<p>Return a mapping from player subsets to <a title="viff.prss.PRF" class="reference" href="prss.html#viff.prss.PRF"><tt class="xref docutils literal"><span class="pre">viff.prss.PRF</span></tt></a>
+instances.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.config.Player.dealer_prfs">
+<!--#viff.config.Player.dealer_prfs#--><tt class="descname">dealer_prfs</tt><big>(</big><em>modulus</em><big>)</big><a class="headerlink" href="#viff.config.Player.dealer_prfs" title="Permalink to this definition">¶</a></dt>
+<dd><p>Retrieve dealer PRSS PRFs.</p>
+<p>The pseudo-random functions are used when this player is the
+dealer in a pseudo-random secret sharing.</p>
+<p>Return a mapping from player subsets to <a title="viff.prss.PRF" class="reference" href="prss.html#viff.prss.PRF"><tt class="xref docutils literal"><span class="pre">viff.prss.PRF</span></tt></a>
+instances.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.config.generate_configs">
+<!--#viff.config.generate_configs#--><tt class="descclassname">viff.config.</tt><tt class="descname">generate_configs</tt><big>(</big><em>n</em>, <em>t</em>, <em>addresses=None</em>, <em>prefix=None</em><big>)</big><a class="headerlink" href="#viff.config.generate_configs" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate player configurations.</p>
+<p>Generates <em>n</em> configuration objects with a threshold of <em>t</em>. The
+<em>addresses</em> is an optional list of <tt class="docutils literal"><span class="pre">(host,</span> <span class="pre">port)</span></tt> pairs and
+<em>prefix</em> is a filename prefix.</p>
+<p>The configurations are returned as <tt class="xref docutils literal"><span class="pre">ConfigObj</span></tt> instances
+and can be saved to disk if desired.</p>
+<p>Returns a mapping from player ID to player configuration.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.config.load_config">
+<!--#viff.config.load_config#--><tt class="descclassname">viff.config.</tt><tt class="descname">load_config</tt><big>(</big><em>source</em><big>)</big><a class="headerlink" href="#viff.config.load_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Load a player configuration file.</p>
+<p>Configuration files are simple INI-files containing information
+(hostname and port number) about the other players in the
+protocol.</p>
+<p>One of the players own the config file and for this player
+additional information on PRSS keys is available.</p>
+<p>Returns the owner ID and a mapping of player IDs to
+<a title="viff.config.Player" class="reference" href="#viff.config.Player"><tt class="xref docutils literal"><span class="pre">Player</span></tt></a> instances.</p>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="prss.html" title="previous chapter">PRSS Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="program-counters.html" title="next chapter">Program Counters</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/config.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="program-counters.html" title="Program Counters" accesskey="N">next</a> |</li>
+          <li class="right"><a href="prss.html" title="PRSS Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/development.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,204 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Developer&#8217;s Guide &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Unit Testing" href="unit-testing.html" />
+    <link rel="prev" title="Coding Style" href="coding-style.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="unit-testing.html" title="Unit Testing" accesskey="N">next</a> |</li>
+          <li class="right"><a href="coding-style.html" title="Coding Style" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="developer-s-guide">Developer&#8217;s Guide<a class="headerlink" href="#developer-s-guide" title="Permalink to this headline">¶</a></h1>
+<p>This page explains what you need to know if you want to start hacking
+on VIFF. In addition to these instructions you will want to read up on
+the <a class="reference" href="coding-style.html">coding style</a> used by VIFF (it is the normal Python style,
+nothing fancy there).</p>
+<div class="section">
+<h2 id="getting-the-source-code">Getting the Source Code<a class="headerlink" href="#getting-the-source-code" title="Permalink to this headline">¶</a></h2>
+<p>VIFF is developed using <a class="reference" href="http://www.selenic.com/mercurial/">Mercurial</a> (also known as <tt class="docutils literal"><span class="pre">hg</span></tt> after its
+command line program). This is a distributed revision control system
+which allows you to participate fully in the development even if you
+do not have what is traditionally known as &#8220;commit access&#8221;. You can
+also work offline and take advantage of the many fast operations
+offered by Mercurial.</p>
+<p>After installing Mercurial you can checkout a copy of the source using
+this command line:</p>
+<pre>hg clone http://hg.viff.dk/viff/</pre>
+<p>This will create a directory called <tt class="docutils literal"><span class="pre">viff/</span></tt> where you will find the
+source code. Please test that VIFF works as expected on your computer
+by following the instructions on <a class="reference" href="unit-testing.html">unit testing</a>.</p>
+</div>
+<div class="section">
+<h2 id="contributing-changes">Contributing Changes<a class="headerlink" href="#contributing-changes" title="Permalink to this headline">¶</a></h2>
+<p>When you have created a new feature or fixed a bug, then you need to
+send your changes to one of the VIFF developers. If you share a file
+system with one of the developers, then the easiest way to get your
+changes back into VIFF is to ensure that one of the developers has
+read access on the repository files. He can then simply pull the
+changesets over and eventually push them out to the VIFF repository.</p>
+<p>Alternatively, you can setup a Mercurial repository where one of the
+developers can <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">pull</span></tt> from. You can do this by uploading your
+clone on some public web server (any webserver works for this since
+the developers can pull using <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">pull</span> <span class="pre">static-http://...</span></tt>) or by
+running:</p>
+<pre>hg serve -p 8000</pre>
+<p>which creates a web server on port 8000 just like the one running at
+<a class="reference" href="http://hg.viff.dk/viff/">http://hg.viff.dk/viff/</a>. The default port number is 8000, so you can
+leave that out.</p>
+<p>A final option is the <a class="reference" href="http://www.selenic.com/mercurial/wiki/index.cgi/PatchbombExtension">patchbomb</a> extension for Mercurial, which will
+allow you to use:</p>
+<pre>hg email -t viff-devel@viff.dk -o</pre>
+<p>to send the changesets not present in the VIFF repository (<tt class="docutils literal"><span class="pre">-o</span></tt>) to
+the VIFF development list (<tt class="docutils literal"><span class="pre">-t</span> <span class="pre">viff-devel&#64;viff.dk</span></tt>). You will
+probably want to test using a <tt class="docutils literal"><span class="pre">-n</span></tt> flag or by sending the patches to
+your own address first to make sure everything looks okay. You can get
+the full list of options using <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">help</span> <span class="pre">email</span></tt>.</p>
+<p>The advantage of using patchbomb is that allows everybody to go over
+the code and comment on it before the changesets are pulled into the
+repository. The mails sent out by patchbomb contain all the metadata
+needed (name of committer, date, parent changeset, etc.) for importing
+the changes into the repository, just as if the changesets had been
+pulled using <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">pull</span></tt>.</p>
+</div>
+<div class="section">
+<h2 id="revising-changes">Revising Changes<a class="headerlink" href="#revising-changes" title="Permalink to this headline">¶</a></h2>
+<p>When developing your changes you will probably make many commits
+representing contained steps. Even though you have made a commit, you
+can still change it <em>as long as you have not shared it with anybody</em>.
+The idea is that you are allowed to rewrite history as you see fit in
+your own private repository, but if your changes have been pulled to
+the outside, then you can no longer change them.</p>
+<p>Also, you can only change commits in a linear history back from your
+repository tip. This means that if you pull in changes from the main
+VIFF repository and merge them periodically, then you can no longer
+edit changesets past the last merge. We therefore recommend that you
+develop your feature until you are satisfied with it and only merges
+with whatever new changesets there might be in the VIFF repository
+when the feature is done and debugged.</p>
+<p>Now, to change a past commit you use the <a class="reference" href="http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension">Mercurial Queues extension</a>
+also known as MQ. It gives you a powerful set of tools to work with
+the past history. The basic concept is that changesets can be
+converted into patches, which depend on each other and form a stack.
+Like any good stack, you can push and pop elements from it. In this
+case you push and pop patches.</p>
+<p>To get started you will want to import the normal changesets into MQ.
+Let us suppose you found an error in revision 430 (use <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">view</span></tt> or
+<tt class="docutils literal"><span class="pre">hg</span> <span class="pre">log</span></tt> to find the revision numbers). You then want to import
+revision 430 and the following changesets into MQ with this command:</p>
+<pre>hg qimport -r 430:tip</pre>
+<p>Nothing much happened — your working directory is left unchanged. To
+see that the command did something you can check the current patch
+series with <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">qseries</span></tt>. When importing changesets revision N is
+called <tt class="docutils literal"><span class="pre">N.diff</span></tt> in the patch series.</p>
+<p>What we want is to pop off the other patches so that <tt class="docutils literal"><span class="pre">430.diff</span></tt> is
+the topmost patch. This is done with:</p>
+<pre>hg qgoto 430.diff</pre>
+<p>This updates your working directory to look exactly like it did when
+you originally committed revision 430! You can now edit the files to
+correct the error you found, and when you are done you run:</p>
+<pre>hg qrefresh</pre>
+<p>to refresh the patch in <tt class="docutils literal"><span class="pre">430.diff</span></tt>. You can use <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">qrefresh</span> <span class="pre">-e</span></tt>
+to edit the commit message too. Now comes the fun part — you must now
+push the the other patches back on the stack with:</p>
+<pre>hg qpush -a</pre>
+<p>If this goes well with no complaints, then you can delete the patches
+again with:</p>
+<pre>hg qdelete -r qbase:qtip</pre>
+<p>The end result is a completely normal repository with no sign of this
+surgery. You can repeat this as many times as needed to slowly develop
+your patches until you are satisfied with the results.</p>
+<p>If the changes you made to the patch are conflicting with other
+patches in your stack, then the pushing will stop where the error was
+encountered, and the conflicting patch hunk is stored in a <tt class="docutils literal"><span class="pre">.rej</span></tt>
+file. There is no need to panic if this happens — all you need to do
+is to determine how the hunk in the <tt class="docutils literal"><span class="pre">.rej</span></tt> file(s) should be applied
+(if at all) and then run <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">qrefresh</span></tt> to indicate that the current
+patch is okay. Now continue applying patches with <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">qpush</span> <span class="pre">-a</span></tt> and
+fix any remaining conflicts.</p>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Developer&#8217;s Guide</a><ul>
+<li><a class="reference" href="#getting-the-source-code">Getting the Source Code</a></li>
+<li><a class="reference" href="#contributing-changes">Contributing Changes</a></li>
+<li><a class="reference" href="#revising-changes">Revising Changes</a></li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="coding-style.html" title="previous chapter">Coding Style</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="unit-testing.html" title="next chapter">Unit Testing</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/development.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="unit-testing.html" title="Unit Testing" accesskey="N">next</a> |</li>
+          <li class="right"><a href="coding-style.html" title="Coding Style" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/field.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,258 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Finite Fields Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Shamir Module" href="shamir.html" />
+    <link rel="prev" title="Utility Functions Module" href="util.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="shamir.html" title="Shamir Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="util.html" title="Utility Functions Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.field">Finite Fields Module<a class="headerlink" href="#module-viff.field" title="Permalink to this headline">¶</a></h1>
+<p>Modeling of Galois (finite) fields. The GF function creates classes
+which implements Galois (finite) fields of prime order whereas the
+<a title="viff.field.GF256" class="reference" href="#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">GF256</span></tt></a> class implements the the GF(2^8) field with
+characteristic 2.</p>
+<p>All fields work the same: instantiate an object from a field to get
+hold of an element of that field. Elements implement the normal
+arithmetic one would expect: addition, multiplication, etc.</p>
+<p>Defining a field:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">19</span><span class="p">)</span>
+</pre></div>
+<p>Defining field elements:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Zp</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">Zp</span><span class="p">(</span><span class="mf">15</span><span class="p">)</span>
+</pre></div>
+<p>Addition and subtraction (with modulo reduction):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span>
+<span class="go">{6}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">-</span> <span class="n">y</span>
+<span class="go">{14}</span>
+</pre></div>
+<p>Exponentiation:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">**</span><span class="mf">3</span>
+<span class="go">{12}</span>
+</pre></div>
+<p>Square roots can be found for elements based on GF fields with a Blum
+prime modulus (see <a title="viff.field.GF" class="reference" href="#viff.field.GF"><tt class="xref docutils literal"><span class="pre">GF()</span></tt></a> for more information):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">sqrt</span><span class="p">()</span>
+<span class="go">{3}</span>
+</pre></div>
+<p>Field elements from different fields cannot be mixed, you will get a
+type error if you try:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Zq</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">17</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span> <span class="o">=</span> <span class="n">Zq</span><span class="p">(</span><span class="mf">2</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">+</span> <span class="n">z</span>
+<span class="gt">Traceback (most recent call last):</span>
+    <span class="o">...</span>
+<span class="nc">TypeError: unsupported operand type(s) for +</span>: <span class="n-Identifier">&#39;GFElement&#39; and &#39;GFElement&#39;</span>
+</pre></div>
+<p>The reason for the slightly confusing error message is that <tt class="docutils literal"><span class="pre">x</span></tt> and
+<tt class="docutils literal"><span class="pre">z</span></tt> are instances of two <em>different</em> classes called <tt class="docutils literal"><span class="pre">GFElement</span></tt>.</p>
+<dl class="class">
+<dt id="viff.field.FieldElement">
+<!--#viff.field.FieldElement#-->class <tt class="descclassname">viff.field.</tt><tt class="descname">FieldElement</tt><a class="headerlink" href="#viff.field.FieldElement" title="Permalink to this definition">¶</a></dt>
+<dd>Common base class for elements.</dd></dl>
+
+<dl class="class">
+<dt id="viff.field.GF256">
+<!--#viff.field.GF256#-->class <tt class="descclassname">viff.field.</tt><tt class="descname">GF256</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#viff.field.GF256" title="Permalink to this definition">¶</a></dt>
+<dd><p>Models an element of the GF(2^8) field.</p>
+<dl class="attribute">
+<dt id="viff.field.GF256.modulus">
+<!--#viff.field.GF256.modulus#--><tt class="descname">modulus</tt><a class="headerlink" href="#viff.field.GF256.modulus" title="Permalink to this definition">¶</a></dt>
+<dd>Field modulus, always 256.</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__sub__">
+<!--#viff.field.GF256.__sub__#--><tt class="descname">__sub__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__sub__" title="Permalink to this definition">¶</a></dt>
+<dt id="viff.field.GF256.__xor__">
+<tt class="descname">__xor__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__xor__" title="Permalink to this definition">¶</a></dt>
+<dd>Subtraction and exclusive-or. Since GF(2^8) has
+characteristic 2, these two operations are identical to
+addition.</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__add__">
+<!--#viff.field.GF256.__add__#--><tt class="descname">__add__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__add__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Add this and another GF256 element.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="n">x01</span><span class="p">)</span> <span class="o">+</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="n">x01</span><span class="p">)</span>
+<span class="go">[0]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="n">x01</span><span class="p">)</span> <span class="o">+</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="n">x02</span><span class="p">)</span>
+<span class="go">[3]</span>
+</pre></div>
+<p>Adding integers works too, the other operand is coerced into a
+GF256 element automatically:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="n">x01</span><span class="p">)</span> <span class="o">+</span> <span class="mf">1</span>
+<span class="go">[0]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__mul__">
+<!--#viff.field.GF256.__mul__#--><tt class="descname">__mul__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__mul__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Multiply this and another GF256.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span> <span class="o">*</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">47</span><span class="p">)</span>
+<span class="go">[0]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">3</span><span class="p">)</span>
+<span class="go">[6]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">16</span><span class="p">)</span> <span class="o">*</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">32</span><span class="p">)</span>
+<span class="go">[54]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__pow__">
+<!--#viff.field.GF256.__pow__#--><tt class="descname">__pow__</tt><big>(</big><em>exponent</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__pow__" title="Permalink to this definition">¶</a></dt>
+<dd>Exponentiation.</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__div__">
+<!--#viff.field.GF256.__div__#--><tt class="descname">__div__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__div__" title="Permalink to this definition">¶</a></dt>
+<dd>Division.</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__neg__">
+<!--#viff.field.GF256.__neg__#--><tt class="descname">__neg__</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.field.GF256.__neg__" title="Permalink to this definition">¶</a></dt>
+<dd>Negation.</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__invert__">
+<!--#viff.field.GF256.__invert__#--><tt class="descname">__invert__</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.field.GF256.__invert__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Invertion.</p>
+<p>Raises <tt class="xref docutils literal"><span class="pre">ZeroDivisionError</span></tt> if trying to inverse the zero
+element.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__eq__">
+<!--#viff.field.GF256.__eq__#--><tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.field.GF256.__eq__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Equality testing.</p>
+<p>Testing for equality with integers works as expected:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span> <span class="o">==</span> <span class="mf">10</span>
+<span class="go">True</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.field.GF256.__nonzero__">
+<!--#viff.field.GF256.__nonzero__#--><tt class="descname">__nonzero__</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.field.GF256.__nonzero__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Truth value testing.</p>
+<p>Returns False if this element is zero, True otherwise. This
+allows GF256 elements to be used directly in Boolean formula:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">bool</span><span class="p">(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">0</span><span class="p">))</span>
+<span class="go">False</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">bool</span><span class="p">(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">1</span><span class="p">))</span>
+<span class="go">True</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="ow">not</span> <span class="n">x</span>
+<span class="go">False</span>
+</pre></div>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.field.GF">
+<!--#viff.field.GF#--><tt class="descclassname">viff.field.</tt><tt class="descname">GF</tt><big>(</big><em>modulus</em><big>)</big><a class="headerlink" href="#viff.field.GF" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate a Galois (finite) field with the given modulus.</p>
+<p>The modulus must be a prime:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Z23</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">23</span><span class="p">)</span> <span class="c"># works</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Z10</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span> <span class="c"># not a prime</span>
+<span class="gt">Traceback (most recent call last):</span>
+    <span class="o">...</span>
+<span class="nc">ValueError</span>: <span class="n-Identifier">10 is not a prime</span>
+</pre></div>
+<p>A modulus of 256 is special since it returns the GF(2^8) field
+even though 256 is no prime:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">GF256</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">256</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
+<span class="go">[1]</span>
+</pre></div>
+<p>Please note, that if you wish to calculate square roots, the
+modulus must be a Blum prime (congruent to 3 mod 4):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Z17</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">17</span><span class="p">)</span> <span class="c"># 17 % 4 == 1, so 17 is no Blum prime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Z17</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">sqrt</span><span class="p">()</span>
+<span class="gt">Traceback (most recent call last):</span>
+    <span class="o">...</span>
+<span class="nc">AssertionError</span>: <span class="n-Identifier">Cannot compute square root of {10} with modulus 17</span>
+</pre></div>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="util.html" title="previous chapter">Utility Functions Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="shamir.html" title="next chapter">Shamir Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/field.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="shamir.html" title="Shamir Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="util.html" title="Utility Functions Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/genindex.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,298 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Index &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+
+   <h1 id="index">Index</h1>
+
+   <a href="#_"><strong>_</strong></a> | <a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#H"><strong>H</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#V"><strong>V</strong></a> | <a href="#W"><strong>W</strong></a> 
+
+   <hr />
+
+   
+<h2 id="_">_</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="field.html#viff.field.GF256.__add__">__add__() (viff.field.GF256 method)</a></dt>
+  <dd><dl>
+    <dt><a href="matrix.html#viff.matrix.Matrix.__add__">(viff.matrix.Matrix method)</a></dt>
+  </dl></dd>
+<dt><a href="prss.html#viff.prss.PRF.__call__">__call__() (viff.prss.PRF method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__div__">__div__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__eq__">__eq__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__invert__">__invert__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__mul__">__mul__() (viff.field.GF256 method)</a></dt>
+  <dd><dl>
+    <dt><a href="matrix.html#viff.matrix.Matrix.__mul__">(viff.matrix.Matrix method)</a></dt>
+  </dl></dd></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="field.html#viff.field.GF256.__neg__">__neg__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__nonzero__">__nonzero__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__pow__">__pow__() (viff.field.GF256 method)</a></dt>
+<dt><a href="matrix.html#viff.matrix.Matrix.__str__">__str__() (viff.matrix.Matrix method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__sub__">__sub__() (viff.field.GF256 method)</a></dt>
+<dt><a href="field.html#viff.field.GF256.__xor__">__xor__() (viff.field.GF256 method)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="A">A</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime">ActiveRuntime (class in viff.runtime)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.add">add() (viff.runtime.Runtime method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.add_options">add_options (viff.runtime.BasicRuntime attribute)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="B">B</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.BasicRuntime">BasicRuntime (class in viff.runtime)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime.broadcast">broadcast() (viff.runtime.ActiveRuntime method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="C">C</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.Share.clone">clone() (viff.runtime.Share method)</a></dt>
+<dt><a href="util.html#viff.util.clone_deferred">clone_deferred() (in module viff.util)</a></dt>
+<dt><a href="comparison.html#ComparisonToft05Mixin">ComparisonToft05Mixin (class in None)</a></dt>
+<dt><a href="comparison.html#ComparisonToft07Mixin">ComparisonToft07Mixin (class in None)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="prss.html#viff.prss.convert_replicated_shamir">convert_replicated_shamir() (in module viff.prss)</a></dt>
+<dt><a href="runtime.html#viff.runtime.create_runtime">create_runtime() (in module viff.runtime)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="D">D</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.Player.dealer_prfs">dealer_prfs() (viff.config.Player method)</a></dt>
+<dt><a href="util.html#viff.util.deprecation">deprecation() (in module viff.util)</a></dt>
+<dt><a href="matrix.html#viff.matrix.Matrix.determinant">determinant() (viff.matrix.Matrix method)</a></dt>
+<dt><a href="util.html#viff.util.dlift">dlift() (in module viff.util)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime.double_share_random">double_share_random() (viff.runtime.ActiveRuntime method)</a></dt>
+<dt><a href="util.html#viff.util.dprint">dprint() (in module viff.util)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="E">E</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt>environment variable</dt>
+  <dd><dl>
+    <dt><a href="util.html#envvar-SEED">SEED</a>, <a href="util.html#index-0">[Link]</a>, <a href="util.html#index-1">[Link]</a></dt>
+    <dt><a href="util.html#envvar-VIFF_NO_WRAP">VIFF_NO_WRAP</a>, <a href="util.html#index-2">[Link]</a>, <a href="util.html#index-3">[Link]</a></dt>
+  </dl></dd></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="F">F</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="field.html#viff.field.FieldElement">FieldElement (class in viff.field)</a></dt>
+<dt><a href="util.html#viff.util.find_prime">find_prime() (in module viff.util)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="G">G</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.generate_configs">generate_configs() (in module viff.config)</a></dt>
+<dt><a href="prss.html#viff.prss.generate_subsets">generate_subsets() (in module viff.prss)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime.generate_triples">generate_triples() (viff.runtime.ActiveRuntime method)</a></dt>
+<dt><a href="field.html#viff.field.GF">GF() (in module viff.field)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="field.html#viff.field.GF256">GF256 (class in viff.field)</a></dt>
+<dt><a href="comparison.html#ComparisonToft05Mixin.greater_than_equal">greater_than_equal() (ComparisonToft05Mixin method)</a></dt>
+  <dd><dl>
+    <dt><a href="comparison.html#ComparisonToft07Mixin.greater_than_equal">(ComparisonToft07Mixin method)</a></dt>
+  </dl></dd>
+</dl></td></tr></table>
+
+<h2 id="H">H</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.Player.host">host (viff.config.Player attribute)</a></dt>
+<dt><a href="matrix.html#viff.matrix.hyper">hyper() (in module viff.matrix)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="I">I</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.Player.id">id (viff.config.Player attribute)</a></dt>
+  <dd><dl>
+    <dt><a href="runtime.html#viff.runtime.BasicRuntime.id">(viff.runtime.BasicRuntime attribute)</a></dt>
+  </dl></dd>
+<dt><a href="runtime.html#viff.runtime.ShareExchanger.incoming_data">incoming_data (viff.runtime.ShareExchanger attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#viff.runtime.increment_pc">increment_pc() (in module viff.runtime)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="L">L</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.load_config">load_config() (in module viff.config)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ShareExchanger.loseConnection">loseConnection() (viff.runtime.ShareExchanger method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="M">M</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="matrix.html#viff.matrix.Matrix">Matrix (class in viff.matrix)</a></dt>
+<dt><a href="field.html#viff.field.GF256.modulus">modulus (viff.field.GF256 attribute)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime.mul">mul() (viff.runtime.ActiveRuntime method)</a></dt>
+  <dd><dl>
+    <dt><a href="runtime.html#viff.runtime.Runtime.mul">(viff.runtime.Runtime method)</a></dt>
+  </dl></dd></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="O">O</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.Runtime.open">open() (viff.runtime.Runtime method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="P">P</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="config.html#viff.config.Player">Player (class in viff.config)</a></dt>
+<dt><a href="config.html#viff.config.Player.port">port (viff.config.Player attribute)</a></dt>
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.preprocess">preprocess() (viff.runtime.BasicRuntime method)</a></dt>
+<dt><a href="prss.html#viff.prss.PRF">PRF (class in viff.prss)</a></dt>
+<dt><a href="config.html#viff.config.Player.prfs">prfs() (viff.config.Player method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.program_counter">program_counter (viff.runtime.BasicRuntime attribute)</a></dt>
+<dt><a href="prss.html#viff.prss.prss">prss() (in module viff.prss)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="prss.html#viff.prss.prss_lsb">prss_lsb() (in module viff.prss)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.prss_shamir_share_bit_double">prss_shamir_share_bit_double() (viff.runtime.Runtime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.prss_share">prss_share() (viff.runtime.Runtime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.prss_share_bit_double">prss_share_bit_double() (viff.runtime.Runtime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.prss_share_random">prss_share_random() (viff.runtime.Runtime method)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="R">R</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="util.html#viff.util.rand">rand (in module viff.util)</a></dt>
+<dt><a href="prss.html#viff.prss.random_replicated_sharing">random_replicated_sharing() (in module viff.prss)</a></dt>
+<dt><a href="shamir.html#viff.shamir.recombine">recombine() (in module viff.shamir)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#viff.runtime.Runtime">Runtime (class in viff.runtime)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="S">S</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.schedule_callback">schedule_callback() (viff.runtime.BasicRuntime method)</a></dt>
+<dt><a href="util.html#index-0">SEED</a>, <a href="util.html#index-1">[Link]</a></dt>
+<dt><a href="runtime.html#viff.runtime.ShareExchanger.sendShare">sendShare() (viff.runtime.ShareExchanger method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.shamir_share">shamir_share() (viff.runtime.Runtime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Share">Share (class in viff.runtime)</a></dt>
+<dt><a href="shamir.html#viff.shamir.share">share() (in module viff.shamir)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#viff.runtime.ShareExchanger">ShareExchanger (class in viff.runtime)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ShareList">ShareList (class in viff.runtime)</a></dt>
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.shutdown">shutdown() (viff.runtime.BasicRuntime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.ActiveRuntime.single_share_random">single_share_random() (viff.runtime.ActiveRuntime method)</a></dt>
+<dt><a href="runtime.html#viff.runtime.Runtime.sub">sub() (viff.runtime.Runtime method)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="T">T</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.threshold">threshold (viff.runtime.BasicRuntime attribute)</a></dt>
+<dt><a href="comparison.html#Toft05Runtime">Toft05Runtime (class in None)</a></dt>
+<dt><a href="comparison.html#Toft07Runtime">Toft07Runtime (class in None)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="matrix.html#viff.matrix.Matrix.transpose">transpose() (viff.matrix.Matrix method)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="V">V</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="shamir.html#viff.shamir.verify_sharing">verify_sharing() (in module viff.shamir)</a></dt>
+<dt><a href="config.html#module-viff.config">viff.config (module)</a></dt>
+<dt><a href="field.html#module-viff.field">viff.field (module)</a></dt>
+<dt><a href="matrix.html#module-viff.matrix">viff.matrix (module)</a></dt>
+<dt><a href="prss.html#module-viff.prss">viff.prss (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="runtime.html#module-viff.runtime">viff.runtime (module)</a></dt>
+<dt><a href="shamir.html#module-viff.shamir">viff.shamir (module)</a></dt>
+<dt><a href="util.html#module-viff.util">viff.util (module)</a></dt>
+<dt><a href="util.html#index-2">VIFF_NO_WRAP</a>, <a href="util.html#index-3">[Link]</a></dt>
+</dl></td></tr></table>
+
+<h2 id="W">W</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="runtime.html#viff.runtime.BasicRuntime.wait_for">wait_for() (viff.runtime.BasicRuntime method)</a></dt>
+<dt><a href="util.html#viff.util.wrapper">wrapper() (in module viff.util)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/glossary.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Glossary &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Welcome to VIFF&#8217;s documentation!" href="index.html" />
+    <link rel="prev" title="VIFF Development Team" href="authors.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="index.html" title="Welcome to VIFF&#8217;s documentation!" accesskey="N">next</a> |</li>
+          <li class="right"><a href="authors.html" title="VIFF Development Team" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="glossary">Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline">¶</a></h1>
+<dl class="glossary docutils">
+<dt id="term-ideal-functionality">Ideal functionality</dt>
+<dd>An ideal functionality is an uncorruptable party in an ideal
+protocol.</dd>
+<dt id="term-program-counter">Program counter</dt>
+<dd>A label associated with an operation, used to identify the data
+when it is received over the network. Please see <a class="reference" href="program-counters.html#program-counters"><em>Program Counters</em></a>.</dd>
+<dt id="term-viff">VIFF</dt>
+<dd>Abbreviation for <em>Virtual Ideal Functionality Framework</em>. VIFF
+allows you to write programs which behave as if they had access
+to an <a class="reference" href="#term-ideal-functionality"><em>ideal functionality</em></a>.</dd>
+</dl>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="authors.html" title="previous chapter">VIFF Development Team</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="index.html" title="next chapter">Welcome to VIFF&#8217;s documentation!</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/glossary.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="index.html" title="Welcome to VIFF&#8217;s documentation!" accesskey="N">next</a> |</li>
+          <li class="right"><a href="authors.html" title="VIFF Development Team" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/implementation.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,139 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Implementation &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Bibliography" href="bibliography.html" />
+    <link rel="prev" title="Presentations" href="presentations.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="bibliography.html" title="Bibliography" accesskey="N">next</a> |</li>
+          <li class="right"><a href="presentations.html" title="Presentations" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="implementation">Implementation<a class="headerlink" href="#implementation" title="Permalink to this headline">¶</a></h1>
+<p>VIFF consists of several modules which will be described next.</p>
+<ul>
+<li><a class="reference" href="util.html">Utility Functions Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="field.html">Finite Fields Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="shamir.html">Shamir Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="matrix.html">Matrix Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="runtime.html">Runtime Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="comparison.html">Comparison protocols</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="prss.html">PRSS Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="config.html">Config Module</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="program-counters.html">Program Counters</a><ul>
+<li><a class="reference" href="program-counters.html#the-naive-solution">The naive solution</a></li>
+<li><a class="reference" href="program-counters.html#the-working-solution">The working solution</a></li>
+<li><a class="reference" href="program-counters.html#alternatives">Alternatives</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="coding-style.html">Coding Style</a><ul>
+<li><a class="reference" href="coding-style.html#the-viff-coding-style-in-short">The VIFF Coding Style in Short</a></li>
+<li><a class="reference" href="coding-style.html#the-twisted-coding-style">The Twisted Coding Style</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="development.html">Developer&#8217;s Guide</a><ul>
+<li><a class="reference" href="development.html#getting-the-source-code">Getting the Source Code</a></li>
+<li><a class="reference" href="development.html#contributing-changes">Contributing Changes</a></li>
+<li><a class="reference" href="development.html#revising-changes">Revising Changes</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="unit-testing.html">Unit Testing</a><ul>
+<li><a class="reference" href="unit-testing.html#running-the-unit-tests">Running the Unit Tests</a></li>
+<li><a class="reference" href="unit-testing.html#writing-unit-tests">Writing Unit Tests</a></li>
+</ul>
+</li>
+</ul>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="presentations.html" title="previous chapter">Presentations</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="bibliography.html" title="next chapter">Bibliography</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/implementation.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="bibliography.html" title="Bibliography" accesskey="N">next</a> |</li>
+          <li class="right"><a href="presentations.html" title="Presentations" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/index.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,138 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Welcome to VIFF&#8217;s documentation! &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="welcome-to-viff-s-documentation">Welcome to VIFF&#8217;s documentation!<a class="headerlink" href="#welcome-to-viff-s-documentation" title="Permalink to this headline">¶</a></h1>
+<p>The Virtual Ideal Functionality Framework is a general framework for
+doing secure multi-party computation.</p>
+<p>Contents:</p>
+<ul>
+<li><a class="reference" href="overview.html">Overview</a><ul>
+<li><a class="reference" href="overview.html#security-assumptions">Security Assumptions</a></li>
+<li><a class="reference" href="overview.html#architecture">Architecture</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="install.html">Installation Guide</a><ul>
+<li><a class="reference" href="install.html#windows">Windows</a></li>
+<li><a class="reference" href="install.html#mac-os-x">Mac OS X</a></li>
+<li><a class="reference" href="install.html#gnu-linux">GNU/Linux</a></li>
+<li><a class="reference" href="install.html#testing">Testing</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="presentations.html">Presentations</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="implementation.html">Implementation</a><ul>
+<li><a class="reference" href="util.html">Utility Functions Module</a></li>
+<li><a class="reference" href="field.html">Finite Fields Module</a></li>
+<li><a class="reference" href="shamir.html">Shamir Module</a></li>
+<li><a class="reference" href="matrix.html">Matrix Module</a></li>
+<li><a class="reference" href="runtime.html">Runtime Module</a></li>
+<li><a class="reference" href="comparison.html">Comparison protocols</a></li>
+<li><a class="reference" href="prss.html">PRSS Module</a></li>
+<li><a class="reference" href="config.html">Config Module</a></li>
+<li><a class="reference" href="program-counters.html">Program Counters</a></li>
+<li><a class="reference" href="coding-style.html">Coding Style</a></li>
+<li><a class="reference" href="development.html">Developer&#8217;s Guide</a></li>
+<li><a class="reference" href="unit-testing.html">Unit Testing</a></li>
+</ul>
+</li>
+</ul>
+<ul>
+<li><a class="reference" href="bibliography.html">Bibliography</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="authors.html">VIFF Development Team</a></li>
+</ul>
+<ul>
+<li><a class="reference" href="glossary.html">Glossary</a></li>
+</ul>
+</div>
+<div class="section">
+<h1 id="indices-and-tables">Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
+<ul class="simple">
+<li><a class="reference" href="genindex.html"><em>Index</em></a></li>
+<li><a class="reference" href="modindex.html"><em>Module Index</em></a></li>
+<li><a class="reference" href="search.html"><em>Search Page</em></a></li>
+</ul>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Welcome to VIFF&#8217;s documentation!</a><ul>
+</ul>
+</li>
+<li><a class="reference" href="#indices-and-tables">Indices and tables</a></li>
+</ul>
+
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/index.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/install.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,305 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Installation Guide &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Presentations" href="presentations.html" />
+    <link rel="prev" title="Overview" href="overview.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="presentations.html" title="Presentations" accesskey="N">next</a> |</li>
+          <li class="right"><a href="overview.html" title="Overview" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="installation-guide">Installation Guide<a class="headerlink" href="#installation-guide" title="Permalink to this headline">¶</a></h1>
+<p>VIFF is written in Python and uses the Twisted framework for
+asynchronous communication, (optionally) python-gnutls for secure
+communication, ConfigObj for configuration files, and GMPY for fast
+bignum arithmetic. You can find these components here:</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field"><th class="field-name">Python:</th><td class="field-body"><a class="reference" href="http://python.org/">http://python.org/</a></td>
+</tr>
+<tr class="field"><th class="field-name">Twisted:</th><td class="field-body"><a class="reference" href="http://twistedmatrix.com/">http://twistedmatrix.com/</a></td>
+</tr>
+<tr class="field"><th class="field-name">python-gnutls:</th><td class="field-body"><a class="reference" href="http://pypi.python.org/pypi/python-gnutls/">http://pypi.python.org/pypi/python-gnutls/</a></td>
+</tr>
+<tr class="field"><th class="field-name">ConfigObj:</th><td class="field-body"><a class="reference" href="http://voidspace.org.uk/python/configobj.html">http://voidspace.org.uk/python/configobj.html</a></td>
+</tr>
+<tr class="field"><th class="field-name">GMPY:</th><td class="field-body"><a class="reference" href="http://code.google.com/p/gmpy/">http://code.google.com/p/gmpy/</a></td>
+</tr>
+</tbody>
+</table>
+<p>VIFF has been successfully tested with the following versions:</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field"><th class="field-name">Python:</th><td class="field-body">2.4.1 and 2.5.0</td>
+</tr>
+<tr class="field"><th class="field-name">Twisted:</th><td class="field-body">2.5.0 (there are <a class="reference" href="http://tracker.viff.dk/issue37">problems with 8.0.1</a>)</td>
+</tr>
+<tr class="field"><th class="field-name">python-gnutls:</th><td class="field-body">1.1.4</td>
+</tr>
+<tr class="field"><th class="field-name">ConfigObj:</th><td class="field-body">4.4.0</td>
+</tr>
+<tr class="field"><th class="field-name">GMPY:</th><td class="field-body">1.0alpha and 1.0.2</td>
+</tr>
+</tbody>
+</table>
+<p>Please <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">report back</a> if you find that VIFF works with other versions
+than the ones listed here.</p>
+<p>Below you will find installation instructions for the different
+platforms on which we <a class="reference" href="http://buildbot.viff.dk/">test VIFF</a>.</p>
+<div class="section">
+<h2 id="windows">Windows<a class="headerlink" href="#windows" title="Permalink to this headline">¶</a></h2>
+<p>This describes the installation procedure for VIFF on Windows. It has
+been tested and verified on Windows XP Professional 2002 SP2 and
+Windows Vista Ultimate SP1.</p>
+<ol class="arabic">
+<li><p class="first">Download and install <a class="reference" href="http://python.org/">Python</a>.</p>
+</li>
+<li><p class="first">Include the path to your Python installation (e.g. <tt class="docutils literal"><span class="pre">C:\Python25\</span></tt>)
+in the <tt class="docutils literal"><span class="pre">PATH</span></tt> system environment variable. One way to edit this
+environment variable is by right-clicking My Computer in the Start
+menu, selecting Properties, Advanced, and then pressing the
+Environment Variables button.</p>
+</li>
+<li><p class="first">Download and install <a class="reference" href="http://twistedmatrix.com/">Twisted</a>.</p>
+</li>
+<li><p class="first">Download <a class="reference" href="http://voidspace.org.uk/python/configobj.html">ConfigObj</a> and enter:</p>
+<pre>python setup.py install</pre>
+<p>from the folder where you unzipped the files.</p>
+</li>
+<li><p class="first">Download and install <a class="reference" href="http://code.google.com/p/gmpy/">GMPY</a>. If you are using Vista, right-click on
+the installer and choose the option to run as administrator.</p>
+</li>
+<li><p class="first">In order to secure the channels between the players using TLS, you
+need to download and install <a class="reference" href="http://pypi.python.org/pypi/python-gnutls/">python-gnutls</a>. However, we haven&#8217;t
+had the time to test installation of this on Windows yet. Feel free
+to contribute with details about this by sending an email to the
+<a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">VIFF mailing list</a>.</p>
+</li>
+<li><p class="first">Download and install <a class="reference" href="http://viff.dk/">VIFF</a>. Note that if you are using the
+installer on Vista, you will again need to run it as an
+administrator.</p>
+</li>
+<li><p class="first">Proceed to <a class="reference" href="#testing">testing</a>.</p>
+</li>
+</ol>
+</div>
+<div class="section">
+<h2 id="mac-os-x">Mac OS X<a class="headerlink" href="#mac-os-x" title="Permalink to this headline">¶</a></h2>
+<p>This describes installation of VIFF on Max OS X 10.5.</p>
+<ol class="arabic">
+<li><p class="first">Download and install the full <a class="reference" href="http://www.pythonmac.org">MacPython</a> version 2.5 (the
+Python-installation which comes with Mac OS X is not entirely
+up-to-date).</p>
+</li>
+<li><p class="first">Download and Install <a class="reference" href="http://twistedmatrix.com/">Twisted</a> from source. Notice again that Mac OS
+X comes with a pre-installed version of Twisted, but this is not
+the full Twisted installation. After installation change your
+<tt class="docutils literal"><span class="pre">PYTHONPATH</span></tt> (in your <tt class="docutils literal"><span class="pre">~/.bash_profile</span></tt>) to:</p>
+<div class="highlight"><pre><span class="n">PATH</span><span class="o">=</span><span class="s">&quot;/Library/Python/2.5/site-packages:${PATH}&quot;</span>
+</pre></div>
+</li>
+<li><p class="first">You can skip this step if you do not want secure connections.
+Otherwise install <a class="reference" href="http://pypi.python.org/pypi/python-gnutls/">python-gnutls</a>:</p>
+<p>a) Install <a class="reference" href="http://developer.apple.com/tools/xcode/">XCode</a> from Apple which provides the GCC compiler.
+b) Install <a class="reference" href="http://www.gnu.org/software/gnutls/manual/gnutls.html#Downloading-and-Installing">gnutls</a> (and required packages) from source.
+c) Install <a class="reference" href="http://pypi.python.org/pypi/python-gnutls/">python-gnutls</a>.</p>
+</li>
+<li><p class="first">Download <a class="reference" href="http://voidspace.org.uk/python/configobj.html">ConfigObj</a> and enter:</p>
+<pre>python setup.py install</pre>
+<p>from the folder where you unzipped the files.</p>
+</li>
+<li><p class="first">Download and install <a class="reference" href="http://code.google.com/p/gmpy/">GMPY</a> following the instructions in
+<tt class="docutils literal"><span class="pre">gmpy-1.02.macosx.README.txt</span></tt> (under Downloads).</p>
+</li>
+<li><p class="first">Install VIFF from source (see below). If you prefer you can just
+install it in site-packages, it makes no difference. For
+developers, it is perhaps a better solution in to create a symbolic
+link from the site-packages directory to the VIFF Python files
+(<tt class="docutils literal"><span class="pre">viff/viff/</span></tt>), as otherwise you need to re-install VIFF each time
+the project is modified.</p>
+</li>
+<li><p class="first">Proceed to <a class="reference" href="#testing">testing</a>.</p>
+</li>
+</ol>
+</div>
+<div class="section">
+<h2 id="gnu-linux">GNU/Linux<a class="headerlink" href="#gnu-linux" title="Permalink to this headline">¶</a></h2>
+<p>VIFF was originally developed on GNU/Linux and is well supported
+there. When installing the VIFF dependencies you either have the
+option of using your <a class="reference" href="#using-a-package-manager">package manager</a> or to install from source. VIFF
+itself must be installed <a class="reference" href="#installing-from-source">from source</a>.</p>
+<div class="section">
+<h3 id="using-a-package-manager">Using a Package Manager<a class="headerlink" href="#using-a-package-manager" title="Permalink to this headline">¶</a></h3>
+<dl class="docutils">
+<dt>Debian Lenny (testing)</dt>
+<dd><p class="first">You can install all dependencies by the command:</p>
+<pre>aptitude install python-twisted-core python-gnutls \
+                 python-configobj python-gmpy</pre>
+<p class="last">The backslash indicates that both lines should be typed as a single
+line in the terminal.</p>
+</dd>
+<dt>Ubuntu</dt>
+<dd>We expect that the instructions for Debian also apply here.</dd>
+</dl>
+<p>If you know how to install using other package managers, please <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">let
+us know</a>.</p>
+<p>VIFF itself is not yet packaged for any distribution, so you will have
+to install it from source as described below.</p>
+</div>
+<div class="section">
+<h3 id="installing-from-source">Installing from Source<a class="headerlink" href="#installing-from-source" title="Permalink to this headline">¶</a></h3>
+<p>If you do not have permission to use the package manager or simply
+prefer to install from source, then (assuming that Python is already
+installed) one can easily install VIFF and its dependencies by
+downloading and unpacking each of them and executing:</p>
+<pre>python setup.py install --home=$HOME/opt</pre>
+<p>That will install everything under the given prefix. With the above
+command the Python modules are installed into:</p>
+<pre>$HOME/opt/lib/python</pre>
+<p>and some programs are installed into:</p>
+<pre>$HOME/opt/bin</pre>
+<p>You should add the first directory to the <tt class="docutils literal"><span class="pre">PYTHONPATH</span></tt> environment
+variable and the latter to the <tt class="docutils literal"><span class="pre">PATH</span></tt> environment variable.</p>
+<p>Bash uses can normally do this by adding:</p>
+<pre>export PYTHONPATH=$PYTHONPATH:$HOME/opt/lib/python
+export PATH=$PATH:$HOME/opt/bin</pre>
+<p>to their <tt class="docutils literal"><span class="pre">~/.bash_profile</span></tt> file, creating it if it is not already
+there. Consult the documentation for your shell to learn how
+environment variables are set.</p>
+</div>
+</div>
+<div class="section">
+<h2 id="testing">Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
+<p>To verify the installation, try out one of the applications. We will
+run the millionaires example with three players and a threshold of
+one. For this test, we will let all players run on localhost: Player 1
+will run on port 9001, player 2 on port 9002, and player 3 on port
+9003. The test is done on Windows, but it works the same on the other
+platforms. Do the following:</p>
+<ol class="arabic">
+<li><p class="first">Go to the <tt class="docutils literal"><span class="pre">viff/apps/</span></tt> directory and generate the needed
+configuration files by entering:</p>
+<pre>python generate-config-files.py -n 3 -t 1
+localhost:9001 localhost:9002 localhost:9003</pre>
+<p>Both lines should be entered as a single line.</p>
+</li>
+<li><p class="first">Open three separate command prompts and go to the <tt class="docutils literal"><span class="pre">viff/apps/</span></tt>
+directory in each. In the first, type:</p>
+<pre>python millionaires.py --no-tls player-3.ini</pre>
+<p>in the second, type:</p>
+<pre>python millionaires.py --no-tls player-2.ini</pre>
+<p>and in the last, type:</p>
+<pre>python millionaires.py --no-tls player-1.ini</pre>
+<p>Note that the order in wich you start the players is important: The
+players must start in reverse order, e.g. the last player first. If
+the installation works, you should see something like this from
+e.g. player 3:</p>
+<pre>C:\viff\apps&gt; python millionaires.py --no-tls player-3.ini
+Seeding random generator with random seed 7416
+Not using TLS
+I am Millionaire 3 and I am worth 20 millions.
+From poorest to richest:
+  Millionaire 2
+  Millionaire 3 (20 millions)
+  Millionaire 1
+Initiating shutdown sequence.</pre>
+<p>If something went wrong, then please <a class="reference" href="http://tracker.viff.dk/">file a bug report</a> or report
+it on the <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">VIFF mailing list</a>. This will help us improve VIFF.</p>
+<p>If things worked as they should, then you are <em>also</em> very welcome
+to send a mail saying so to <a class="reference" href="mailto:viff-devel&#37;&#52;&#48;viff&#46;dk">VIFF mailing list</a>! We would love to
+hear your feedback.</p>
+</li>
+</ol>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Installation Guide</a><ul>
+<li><a class="reference" href="#windows">Windows</a></li>
+<li><a class="reference" href="#mac-os-x">Mac OS X</a></li>
+<li><a class="reference" href="#gnu-linux">GNU/Linux</a><ul>
+<li><a class="reference" href="#using-a-package-manager">Using a Package Manager</a></li>
+<li><a class="reference" href="#installing-from-source">Installing from Source</a></li>
+</ul>
+</li>
+<li><a class="reference" href="#testing">Testing</a></li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="overview.html" title="previous chapter">Overview</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="presentations.html" title="next chapter">Presentations</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/install.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="presentations.html" title="Presentations" accesskey="N">next</a> |</li>
+          <li class="right"><a href="overview.html" title="Overview" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/matrix.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,196 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Matrix Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Runtime Module" href="runtime.html" />
+    <link rel="prev" title="Shamir Module" href="shamir.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="runtime.html" title="Runtime Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="shamir.html" title="Shamir Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.matrix">Matrix Module<a class="headerlink" href="#module-viff.matrix" title="Permalink to this headline">¶</a></h1>
+<p>Matrix operations. This module contains basic matrix operations as
+well as a function to build square hyper-invertible matrices. The
+matrix implementation provides operator overloading and works with any
+type that acts like a number, including <a title="viff.field.GF256" class="reference" href="field.html#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">viff.field.GF256</span></tt></a> and
+<a title="viff.field.GF" class="reference" href="field.html#viff.field.GF"><tt class="xref docutils literal"><span class="pre">viff.field.GF()</span></tt></a> elements.</p>
+<dl class="class">
+<dt id="viff.matrix.Matrix">
+<!--#viff.matrix.Matrix#-->class <tt class="descclassname">viff.matrix.</tt><tt class="descname">Matrix</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#viff.matrix.Matrix" title="Permalink to this definition">¶</a></dt>
+<dd><p>A matrix.</p>
+<dl class="method">
+<dt id="viff.matrix.Matrix.__add__">
+<!--#viff.matrix.Matrix.__add__#--><tt class="descname">__add__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.matrix.Matrix.__add__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Adds another matrix or an element to this matrix.</p>
+<p>Adds this matrix with another matrix, or adds the matrix with
+an element. The addition is done element-wise.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">Matrix</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mf">2</span><span class="o">*</span><span class="n">y</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">2</span><span class="p">)]</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">2</span><span class="p">)])</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span>
+<span class="go">[[0 1]</span>
+<span class="go"> [2 3]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span> <span class="o">+</span> <span class="mf">10</span>
+<span class="go">[[10 11]</span>
+<span class="go"> [12 13]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span> <span class="o">+</span> <span class="n">A</span>
+<span class="go">[[0 2]</span>
+<span class="go"> [4 6]]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.matrix.Matrix.__mul__">
+<!--#viff.matrix.Matrix.__mul__#--><tt class="descname">__mul__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#viff.matrix.Matrix.__mul__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Matrix multiplication.</p>
+<p>Multiplies this matrix with another matrix, or multiplies the
+matrix with an element.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">Matrix</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mf">2</span><span class="o">*</span><span class="n">y</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">2</span><span class="p">)]</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">2</span><span class="p">)])</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span>
+<span class="go">[[0 1]</span>
+<span class="go"> [2 3]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span> <span class="o">*</span> <span class="mf">10</span>
+<span class="go">[[ 0 10]</span>
+<span class="go"> [20 30]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">A</span> <span class="o">*</span> <span class="n">A</span>
+<span class="go">[[ 2  3]</span>
+<span class="go"> [ 6 11]]</span>
+</pre></div>
+<p>The matrices must have compatible dimensions:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Matrix</span><span class="p">(</span><span class="mf">1</span><span class="p">,</span> <span class="mf">5</span><span class="p">)</span> <span class="o">*</span> <span class="n">Matrix</span><span class="p">(</span><span class="mf">2</span><span class="p">,</span> <span class="mf">3</span><span class="p">)</span>
+<span class="gt">Traceback (most recent call last):</span>
+    <span class="o">...</span>
+<span class="nc">ValueError</span>: <span class="n-Identifier">Matrix dimensions do not match for multiplication</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.matrix.Matrix.__str__">
+<!--#viff.matrix.Matrix.__str__#--><tt class="descname">__str__</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.matrix.Matrix.__str__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns a string representation of the matrix.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">Matrix</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mf">4</span><span class="o">*</span><span class="n">y</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">4</span><span class="p">)]</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">4</span><span class="p">)])</span>
+<span class="go">[[ 0  1  2  3]</span>
+<span class="go"> [ 4  5  6  7]</span>
+<span class="go"> [ 8  9 10 11]</span>
+<span class="go"> [12 13 14 15]]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.matrix.Matrix.transpose">
+<!--#viff.matrix.Matrix.transpose#--><tt class="descname">transpose</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.matrix.Matrix.transpose" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns the transpose of the matrix.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">M</span> <span class="o">=</span> <span class="n">Matrix</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mf">3</span><span class="o">*</span><span class="n">y</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">3</span><span class="p">)]</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">3</span><span class="p">)])</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">M</span>
+<span class="go">[[0 1 2]</span>
+<span class="go"> [3 4 5]</span>
+<span class="go"> [6 7 8]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">M</span><span class="o">.</span><span class="n">transpose</span><span class="p">()</span>
+<span class="go">[[0 3 6]</span>
+<span class="go"> [1 4 7]</span>
+<span class="go"> [2 5 8]]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.matrix.Matrix.determinant">
+<!--#viff.matrix.Matrix.determinant#--><tt class="descname">determinant</tt><big>(</big><em>mat</em><big>)</big><a class="headerlink" href="#viff.matrix.Matrix.determinant" title="Permalink to this definition">¶</a></dt>
+<dd>Calculates the determinant of a square matrix.</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.matrix.hyper">
+<!--#viff.matrix.hyper#--><tt class="descclassname">viff.matrix.</tt><tt class="descname">hyper</tt><big>(</big><em>n</em>, <em>field</em><big>)</big><a class="headerlink" href="#viff.matrix.hyper" title="Permalink to this definition">¶</a></dt>
+<dd><p>Makes an <em>n</em> times <em>n</em> hyper-invertible square matrix.
+The matrix entries will belong to <em>field</em>.</p>
+<p>A hyper-invertible matrix is a matrix where every sub-matrix is
+invertible. A sub-matrix consists of an arbitrary subset of the
+rows and columns of the original matrix (and is not necessarily a
+contiguous region).</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">field</span> <span class="k">import</span> <span class="n">GF</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">47</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">hyper</span><span class="p">(</span><span class="mf">2</span><span class="p">,</span> <span class="n">Zp</span><span class="p">)</span>
+<span class="go">[[{46}  {2}]</span>
+<span class="go"> [{45}  {3}]]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">hyper</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="n">Zp</span><span class="p">)</span>
+<span class="go">[[ {1} {44}  {3}]</span>
+<span class="go"> [ {3} {39}  {6}]</span>
+<span class="go"> [ {6} {32} {10}]]</span>
+</pre></div>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="shamir.html" title="previous chapter">Shamir Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="runtime.html" title="next chapter">Runtime Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/matrix.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="runtime.html" title="Runtime Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="shamir.html" title="Shamir Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/modindex.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,107 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Global Module Index &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+
+   <h1 id="global-module-index">Global Module Index</h1>
+
+
+
+   <table width="100%" class="indextable" cellspacing="0" cellpadding="2"><tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
+   <tr class="cap"><td></td><td><strong>V</strong></td><td></td></tr><tr>
+     <td><img src="_static/minus.png" id="toggle-1"
+            class="toggler" style="display: none" /></td>
+     <td>
+     <tt class="xref">viff</tt></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="config.html#module-viff.config"><tt class="xref">viff.config</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="field.html#module-viff.field"><tt class="xref">viff.field</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="matrix.html#module-viff.matrix"><tt class="xref">viff.matrix</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="prss.html#module-viff.prss"><tt class="xref">viff.prss</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="runtime.html#module-viff.runtime"><tt class="xref">viff.runtime</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="shamir.html#module-viff.shamir"><tt class="xref">viff.shamir</tt></a></td><td>
+     <em></em></td></tr><tr class="cg-1">
+     <td></td>
+     <td>&nbsp;&nbsp;&nbsp;
+     <a href="util.html#module-viff.util"><tt class="xref">viff.util</tt></a></td><td>
+     <em></em></td></tr>
+   </table>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/overview.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,172 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Overview &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Installation Guide" href="install.html" />
+    <link rel="prev" title="Welcome to VIFF&#8217;s documentation!" href="index.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="install.html" title="Installation Guide" accesskey="N">next</a> |</li>
+          <li class="right"><a href="index.html" title="Welcome to VIFF&#8217;s documentation!" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="overview">Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h1>
+<p>VIFF allows you to write a program which will interact with other
+programs in order to execute a joint computation. This is called a
+multi-party computation, MPC for short.</p>
+<p>The programs will implement what we call a virtual <a class="reference" href="glossary.html#term-ideal-functionality"><em>ideal
+functionality</em></a> (IF). The idea is that the behavior of the programs
+should be indistinguishable from the behavior of programs interacting
+with a so-called ideal functionality. An ideal functionality is a
+player that cannot be corrupted, also known as a trusted third party
+(TTP).</p>
+<p>Interacting with an IF is easy: all players give their inputs to the
+IF, which computes the results. The results are then distributed to
+the correct players. The inputs and the results are sent over secure
+channels, and since the IF cannot be corrupted, this ideal protocol
+must be secure.</p>
+<p>In the real world there is no IF, but VIFF allows you to implement a
+virtual ideal functionality. The behavior of a bunch of programs using
+VIFF is indistinguishable from program running in the ideal world. It
+is indistinguishable in the sense that everything that can happen in
+the real world protocol could happen in the ideal world too. And since
+no attacks can occur in the ideal world, no attacks can occur in the
+real world as well. Such a multi-party computation (MPC) is called a
+secure multi-party computation (SMPC).</p>
+<div class="section">
+<h2 id="security-assumptions">Security Assumptions<a class="headerlink" href="#security-assumptions" title="Permalink to this headline">¶</a></h2>
+<p>Please note that like all cryptographic systems, VIFF is only secure
+as long as certain assumptions are fulfilled. These assumptions
+include:</p>
+<ul class="simple">
+<li>The adversary can only corrupt up to a certain threshold of the
+total number of players. The threshold will normally be 1/2 of the
+players, so for three players, at most one player may be corrupted
+(there must be an honest majority).</li>
+<li>The adversary is computationally bounded. The protocols used by VIFF
+rely on certain computational hardness assumptions, and therefore
+only polynomial time adversaries are allowed.</li>
+<li>The adversary is passive. Being passive means that the adversary
+only monitors the network traffic, but still follows the protocol.
+We plan to add support for active (Byzantine) adversaries in a
+future version.</li>
+</ul>
+<p>The precise assumptions for each protocol will eventually be included
+in the documentation for the corresponding method, but this has not
+yet been done.</p>
+</div>
+<div class="section">
+<h2 id="architecture">Architecture<a class="headerlink" href="#architecture" title="Permalink to this headline">¶</a></h2>
+<p>VIFF consists of several modules. The <a title="" class="reference" href="runtime.html"><tt class="xref docutils literal"><span class="pre">viff.runtime</span></tt></a> module
+contains the <a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> and <a title="viff.runtime.Share" class="reference" href="runtime.html#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a> classes, in which the main functionality is
+implemented. The <a title="" class="reference" href="field.html"><tt class="xref docutils literal"><span class="pre">viff.field</span></tt></a> module contains implementations of
+finite fields &#8212; these are the values inside the shares. Other
+modules provide support functions.</p>
+<div class="section">
+<h3 id="layers">Layers<a class="headerlink" href="#layers" title="Permalink to this headline">¶</a></h3>
+<p>The main functionality in VIFF is implemented in the <a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> class. This class offers methods to do
+addition, multiplication, etc. These methods operate on <a title="viff.runtime.Share" class="reference" href="runtime.html#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a> instances.</p>
+<p>Shares hold either <a title="viff.field.GF" class="reference" href="field.html#viff.field.GF"><tt class="xref docutils literal"><span class="pre">GFElement</span></tt></a> or <a title="viff.field.GF256" class="reference" href="field.html#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">GF256</span></tt></a> elements and are created from the
+<tt class="xref docutils literal"><span class="pre">shamir_share</span> </tt> or
+<tt class="xref docutils literal"><span class="pre">prss_share</span> </tt> <a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> methods. Shares overload the standard
+arithmetic operators, so you can write <tt class="docutils literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">b</span> <span class="pre">-</span> <span class="pre">c</span> <span class="pre">*</span> <span class="pre">d</span></tt> with four
+shares, and it will be translated correctly into the appropriate
+method calls on the <a title="viff.runtime.Runtime" class="reference" href="runtime.html#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> associated
+with the shares.</p>
+<p>A field element contain the concrete value on which we do
+calculations. This is just a normal Python (long) integer. The value
+is wrapped in an object that will keep track of doing modulo
+reductions as appropriate.</p>
+<p>So in a nutshell, VIFF has these layers:</p>
+<ul class="simple">
+<li>Top-level layer for application programs: There you manipulate
+Python integers or <a title="viff.runtime.Share" class="reference" href="runtime.html#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">viff.runtime.Share</span></tt></a> instances.</li>
+<li>Runtime layer: The runtime deals with Python integers or shares.</li>
+<li>Field elements: Deals with arithmetic over Python integers, but with
+modulo reductions as needed.</li>
+</ul>
+</div>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Overview</a><ul>
+<li><a class="reference" href="#security-assumptions">Security Assumptions</a></li>
+<li><a class="reference" href="#architecture">Architecture</a><ul>
+<li><a class="reference" href="#layers">Layers</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="index.html" title="previous chapter">Welcome to VIFF&#8217;s documentation!</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="install.html" title="next chapter">Installation Guide</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/overview.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="install.html" title="Installation Guide" accesskey="N">next</a> |</li>
+          <li class="right"><a href="index.html" title="Welcome to VIFF&#8217;s documentation!" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/presentations.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,105 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Presentations &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="next" title="Implementation" href="implementation.html" />
+    <link rel="prev" title="Installation Guide" href="install.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="N">next</a> |</li>
+          <li class="right"><a href="install.html" title="Installation Guide" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="presentations">Presentations<a class="headerlink" href="#presentations" title="Permalink to this headline">¶</a></h1>
+<p>The following VIFF-related presentations are available:</p>
+<dl class="docutils">
+<dt>February 21st, 2008:</dt>
+<dd><p class="first">Slides used at a PhD Qualification Exam by Martin Geisler. Like the
+report they accompany, the second part of the slides are about VIFF
+and includes benchmark results.</p>
+<p class="last">Available as <a class="reference" href="http://viff.dk/files/mg-progress-report-talk.pdf">PDF</a>.</p>
+</dd>
+<dt>January 15th, 2008:</dt>
+<dd><p class="first">PhD Progress Report by Martin Geisler. The second part of the report
+describes the design of VIFF and proves it secure in the Universally
+Composability security framework by Canetti.</p>
+<p class="last">Available as <a class="reference" href="http://viff.dk/files/mg-progress-report.pdf">PDF</a>.</p>
+</dd>
+<dt>September 20th, 2007:</dt>
+<dd><p class="first">VIFF Design Talk given by Martin Geisler at a <a class="reference" href="http://simap.dk/">SIMAP</a> meeting. The
+talk describes some of the goals of the VIFF design. It is current
+to version 0.2 of VIFF.</p>
+<p class="last">Available as <a class="reference" href="http://viff.dk/files/design-talk.pdf">PDF</a>.</p>
+</dd>
+</dl>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="install.html" title="previous chapter">Installation Guide</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="implementation.html" title="next chapter">Implementation</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/presentations.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="N">next</a> |</li>
+          <li class="right"><a href="install.html" title="Installation Guide" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/program-counters.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,265 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Program Counters &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Coding Style" href="coding-style.html" />
+    <link rel="prev" title="Config Module" href="config.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="coding-style.html" title="Coding Style" accesskey="N">next</a> |</li>
+          <li class="right"><a href="config.html" title="Config Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="id1"><span id="program-counters"></span>Program Counters<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
+<p>When two players execute a large computation they need to agree with
+each other on a labelling of the individual operations so that they
+know where each received result belongs. In VIFF we call these labels
+<em>program counters</em>. We will try to explain the design of these
+counters in this document and list some ideas for alternative
+implementations.</p>
+<p>The basic setup in VIFF is a set of players who communicate over
+reliable point-to-point links, e.g., TCP or SSL connections. It is
+important to remember that these links guarantee that all transmitted
+messages arrive unchanged at the destination and that they arrive in
+the order sent.</p>
+<div class="section">
+<h2 id="the-naive-solution">The naive solution<a class="headerlink" href="#the-naive-solution" title="Permalink to this headline">¶</a></h2>
+<p>The very first version of VIFF network data was numbered in the most
+naive way possible: using a single counter for each player. This
+worked fine most of the time, but once in a while a test would fail to
+give the correct result. It was only when one ran thousands of
+multiplications that the bug appeared, but its cause was quite simple.
+Consider a program like this where we assume that the shares <em>a</em>, <em>b</em>,
+<em>c</em>, and <em>d</em> have already been correctly defined:</p>
+<div class="highlight"><pre><span class="n">x</span> <span class="o">=</span> <span class="n">mul</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
+<span class="n">y</span> <span class="o">=</span> <span class="n">mul</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">d</span><span class="p">)</span>
+</pre></div>
+<p>Back then, the <tt class="xref docutils literal"><span class="pre">mul()</span></tt> function was implemented like this:</p>
+<div class="highlight"><pre><span class="k">def</span> <span class="nf">mul</span><span class="p">(</span><span class="n">share_a</span><span class="p">,</span> <span class="n">share_b</span><span class="p">):</span>
+    <span class="n">inc_pc</span><span class="p">()</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">gather_shares</span><span class="p">([</span><span class="n">share_a</span><span class="p">,</span> <span class="n">share_b</span><span class="p">])</span>
+    <span class="n">result</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="k">lambda</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span>
+    <span class="n">result</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">shamir_share</span><span class="p">)</span>
+    <span class="n">result</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">recombine</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">2</span><span class="o">*</span><span class="n">threshold</span><span class="p">)</span>
+    <span class="k">return</span> <span class="n">result</span>
+</pre></div>
+<p>where <tt class="xref docutils literal"><span class="pre">inc_pc()</span></tt> took care of incrementing the global program
+counter. This simple implementation worked 99.99% of the time with
+three players connected on a LAN, but once in a while it would fail to
+calculate the correct results.</p>
+<p>In our example program, <tt class="xref docutils literal"><span class="pre">shamir_share()</span></tt> is called twice: once
+when <em>a</em> and <em>b</em> are ready, and once when <em>c</em> and <em>d</em> are ready. Most
+of the time <em>a</em> and <em>b</em> are ready first on all players, and so they
+all agree on the program counter value for this call to
+<tt class="xref docutils literal"><span class="pre">shamir_share()</span></tt>. But when we have bad luck, they one player sees
+<em>c</em> and <em>d</em> arrive first and so the two calls to <tt class="xref docutils literal"><span class="pre">shamir_share()</span></tt>
+are switched for that player.</p>
+<p>The problem is the asynchronous nature of Twisted: all players agree
+on the execution tree, but depending on the exact timing they might
+reach the nodes in the tree in a different order. The tree looks like
+this in our little example:</p>
+<div class="highlight"><pre>  x       y
+  |       |
+ mul     mul
+ / \     / \
+a   b   c   d
+</pre></div>
+<p>and the two <tt class="xref docutils literal"><span class="pre">mul()</span></tt> can be called in either order since they do
+not depend on each other.</p>
+</div>
+<div class="section">
+<h2 id="the-working-solution">The working solution<a class="headerlink" href="#the-working-solution" title="Permalink to this headline">¶</a></h2>
+<p>The solution used now in VIFF has two ingredients. First, callbacks
+that depend on the program counter (like <cite>func</cite>:shamir_share in our
+example above) are not added with <tt class="xref docutils literal"><span class="pre">addCallback()</span></tt> but instead with
+the special <a title="viff.runtime.BasicRuntime.schedule_callback" class="reference" href="runtime.html#viff.runtime.BasicRuntime.schedule_callback"><tt class="xref docutils literal"><span class="pre">viff.runtime.BasicRuntime.schedule_callback()</span></tt></a>
+method. This method saves the program counter in effect at the time of
+the its call, and ensures that the saved program counter is
+temporarily made active when the callback is called.</p>
+<p>Secondly, the program counter is a <em>list</em> of counters. This is
+necessary to ensure that we can allocate new fresh counters at any
+point in the execution tree. The execution tree is never explicitly
+constructed in VIFF, so a simple static numbering is not possible.</p>
+<p>Instead we mark methods that need to increment the program counter
+with the <a title="viff.runtime.increment_pc" class="reference" href="runtime.html#viff.runtime.increment_pc"><tt class="xref docutils literal"><span class="pre">viff.runtime.increment_pc()</span></tt></a> decorator. The program
+counter starts at the value <tt class="docutils literal"><span class="pre">[0]</span></tt> and the decorated method will now
+begin by doing:</p>
+<div class="highlight"><pre><span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="p">[</span><span class="o">-</span><span class="mf">1</span><span class="p">]</span> <span class="o">+=</span> <span class="mf">1</span>
+<span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span>
+</pre></div>
+<p>before it executes its body. When the body is finished, the method
+does:</p>
+<div class="highlight"><pre><span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+<p>before it returns. A method <tt class="xref docutils literal"><span class="pre">foo()</span></tt> defined like this:</p>
+<div class="highlight"><pre><span class="nd">@increment_pc</span>
+<span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+    <span class="k">print</span> <span class="s">&quot;foo:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span>
+</pre></div>
+<p>is thus turned into this:</p>
+<div class="highlight"><pre><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+    <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="p">[</span><span class="o">-</span><span class="mf">1</span><span class="p">]</span> <span class="o">+=</span> <span class="mf">1</span>
+    <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;foo:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span>
+    <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+<p>and when executed starting from the initial program counter of <tt class="docutils literal"><span class="pre">[0]</span></tt>
+we see that it prints <tt class="docutils literal"><span class="pre">foo:</span> <span class="pre">[1,</span> <span class="pre">0]</span></tt> and leaves the program counter
+at <tt class="docutils literal"><span class="pre">[1]</span></tt> after it returns. It is very important that the program
+counter is left changed like this, for this means that the next call
+to <tt class="xref docutils literal"><span class="pre">foo()</span></tt> will print <tt class="docutils literal"><span class="pre">foo:</span> <span class="pre">[2,</span> <span class="pre">0]</span></tt> and increment the program
+counter to <tt class="docutils literal"><span class="pre">[2]</span></tt>.</p>
+<p>If we have a method <tt class="xref docutils literal"><span class="pre">bar()</span></tt> which calls <tt class="xref docutils literal"><span class="pre">foo()</span></tt> several times:</p>
+<div class="highlight"><pre><span class="nd">@increment_pc</span>
+<span class="k">def</span> <span class="nf">bar</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+    <span class="k">print</span> <span class="s">&quot;bar:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span>
+    <span class="bp">self</span><span class="o">.</span><span class="n">foo</span><span class="p">()</span>
+    <span class="k">print</span> <span class="s">&quot;bar:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span>
+    <span class="bp">self</span><span class="o">.</span><span class="n">foo</span><span class="p">()</span>
+    <span class="k">print</span> <span class="s">&quot;bar:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">program_counter</span>
+</pre></div>
+<p>then the result of calling <tt class="xref docutils literal"><span class="pre">bar()</span></tt> will be:</p>
+<div class="highlight"><pre>bar: [1, 0]
+foo: [1, 1, 0]
+bar: [1, 1]
+foo: [1, 2, 0]
+bar: [1, 2]
+</pre></div>
+<p>Notice how each sub-call adds another digit to the counter and how it
+increments the counter used at the level of the caller. This system
+ensures that all program counters are unique.</p>
+</div>
+<div class="section">
+<h2 id="alternatives">Alternatives<a class="headerlink" href="#alternatives" title="Permalink to this headline">¶</a></h2>
+<p>We have come up with some alternative solutions, which are detailed
+below. More good ideas are of course welcome!</p>
+<div class="section">
+<h3 id="history-based-labels">History-based labels<a class="headerlink" href="#history-based-labels" title="Permalink to this headline">¶</a></h3>
+<p>An attractive alternative is to label data sent over the net based on
+its <em>history</em>. The idea is that we associate a label <tt class="docutils literal"><span class="pre">H(x)</span></tt> with
+each variable <em>x</em>. The history is defined when new variables are
+defined &#8212; if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">=</span> <span class="pre">a</span> <span class="pre">*</span> <span class="pre">b</span></tt>, then we can set <tt class="docutils literal"><span class="pre">H(x)</span> <span class="pre">=</span> <span class="pre">(&quot;mul&quot;,</span> <span class="pre">H(a),</span>
+<span class="pre">H(b))</span></tt>. To avoid growing the history without bounds we can hash it
+with a cryptographic hash function to bring it down to a fixed size.</p>
+<p>The problem with this idea is that we sometimes need to assign a
+history to a variable that depends on no other variables. An example
+of this is the result of a call to <tt class="xref docutils literal"><span class="pre">prss_share</span>
+</tt> which takes no useful arguments. A
+possible solution would be to add some dummy arguments on which the
+history could be based, even though they wont be used by the method.
+So if you would normally call the function <tt class="xref docutils literal"><span class="pre">hat()</span></tt> with no
+arguments to get a <tt class="xref docutils literal"><span class="pre">Rabbit</span></tt> object, you have to change your
+code from this:</p>
+<div class="highlight"><pre><span class="n">rabbit</span> <span class="o">=</span> <span class="n">hat</span><span class="p">()</span>
+</pre></div>
+<p>to this:</p>
+<div class="highlight"><pre><span class="n">rabbit</span> <span class="o">=</span> <span class="n">hat</span><span class="p">(</span><span class="n">dummy</span><span class="o">=</span><span class="nb">locals</span><span class="p">())</span>
+</pre></div>
+<p>where the call to <tt class="xref docutils literal"><span class="pre">locals()</span></tt> gives you access to the local
+variables. If the use of <tt class="xref docutils literal"><span class="pre">locals()</span></tt> could be hidden this might be
+an acceptable solution.</p>
+<p>Using the history of the variables has the big advantage that we label
+each piece of transmitted data with just information that is relevant
+to it: namely its position in the tree formed by the calculation and
+<em>not</em> its position in the execution tree formed by the implementation
+in VIFF. This is conceptually cleaner than the current solution.</p>
+</div>
+<div class="section">
+<h3 id="program-transformation">Program transformation<a class="headerlink" href="#program-transformation" title="Permalink to this headline">¶</a></h3>
+<p>Another idea is to solve the labelling problem by having some external
+tool transform the program into one with explicit labels. Each send
+and each receive operation needs to be labelled and the labels much
+match pair-wise.</p>
+<p>It is not entirely clear how this should work in the presence of loops
+and if it is possible to implement this in an easier way than the
+current program counters.</p>
+</div>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Program Counters</a><ul>
+<li><a class="reference" href="#the-naive-solution">The naive solution</a></li>
+<li><a class="reference" href="#the-working-solution">The working solution</a></li>
+<li><a class="reference" href="#alternatives">Alternatives</a><ul>
+<li><a class="reference" href="#history-based-labels">History-based labels</a></li>
+<li><a class="reference" href="#program-transformation">Program transformation</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="config.html" title="previous chapter">Config Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="coding-style.html" title="next chapter">Coding Style</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/program-counters.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="coding-style.html" title="Coding Style" accesskey="N">next</a> |</li>
+          <li class="right"><a href="config.html" title="Config Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/prss.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,244 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>PRSS Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Config Module" href="config.html" />
+    <link rel="prev" title="Comparison protocols" href="comparison.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="config.html" title="Config Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="comparison.html" title="Comparison protocols" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.prss">PRSS Module<a class="headerlink" href="#module-viff.prss" title="Permalink to this headline">¶</a></h1>
+<p>Methods for pseudo-random secret sharing. Normal Shamir sharing
+(see the <a title="" class="reference" href="shamir.html"><tt class="xref docutils literal"><span class="pre">viff.shamir</span></tt></a> module) requires secure channels between
+the players for distributing shares. With pseudo-random secret sharing
+one can share a secret using a single broadcast instead.</p>
+<p>PRSS relies on each player having access to a set of previously
+distributed pseudo-random functions (PRFs) &#8212; or rather the seeds for
+such functions. In VIFF, such seeds are generated by
+<a title="viff.config.generate_configs" class="reference" href="config.html#viff.config.generate_configs"><tt class="xref docutils literal"><span class="pre">viff.config.generate_configs()</span></tt></a>. The
+<a title="viff.config.Player.prfs" class="reference" href="config.html#viff.config.Player.prfs"><tt class="xref docutils literal"><span class="pre">viff.config.Player.prfs()</span></tt></a> and
+<a title="viff.config.Player.dealer_prfs" class="reference" href="config.html#viff.config.Player.dealer_prfs"><tt class="xref docutils literal"><span class="pre">viff.config.Player.dealer_prfs()</span></tt></a> methods give access to the
+PRFs.</p>
+<p>In this module the function <a title="viff.prss.prss" class="reference" href="#viff.prss.prss"><tt class="xref docutils literal"><span class="pre">prss()</span></tt></a> is used to calculate shares
+for a pseudo-random number. The <a title="viff.prss.generate_subsets" class="reference" href="#viff.prss.generate_subsets"><tt class="xref docutils literal"><span class="pre">generate_subsets()</span></tt></a> function is a
+general utility for generating subsets of a specific size.</p>
+<p>The code is based on the paper &#8220;Share Conversion, Pseudorandom
+Secret-Sharing and Applications to Secure Computation&#8221; by Ronald
+Cramer, Ivan Damgård, and Yuval Ishai in Proc. of TCC 2005, LNCS 3378.
+<a class="reference" href="http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps">Download</a>.</p>
+<dl class="class">
+<dt id="viff.prss.PRF">
+<!--#viff.prss.PRF#-->class <tt class="descclassname">viff.prss.</tt><tt class="descname">PRF</tt><big>(</big><em>key</em>, <em>max</em><big>)</big><a class="headerlink" href="#viff.prss.PRF" title="Permalink to this definition">¶</a></dt>
+<dd><p>Models a pseudo random function (a PRF).</p>
+<p>The numbers are based on a SHA1 hash of the initial key.</p>
+<p>Each PRF is created based on a key (which should be random and
+secret) and a maximum (which may be public):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;some random key&quot;</span><span class="p">,</span> <span class="mf">256</span><span class="p">)</span>
+</pre></div>
+<p>Calling f return values between zero and the given maximum:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
+<span class="go">246L</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">(</span><span class="mf">2</span><span class="p">)</span>
+<span class="go">254L</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">(</span><span class="mf">3</span><span class="p">)</span>
+<span class="go">13L</span>
+</pre></div>
+<dl class="method">
+<dt id="viff.prss.PRF.__call__">
+<!--#viff.prss.PRF.__call__#--><tt class="descname">__call__</tt><big>(</big><em>input</em><big>)</big><a class="headerlink" href="#viff.prss.PRF.__call__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Return a number based on input.</p>
+<p>If the input is not already a string, it is hashed (using the
+normal Python hash built-in) and the hash value is used
+instead. The hash value is a 32 bit value, so a string should
+be given if one wants to evaluate the PRF on more that 2**32
+different values.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">prf</span> <span class="o">=</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;key&quot;</span><span class="p">,</span> <span class="mf">1000</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prf</span><span class="p">(</span><span class="mf">1</span><span class="p">),</span> <span class="n">prf</span><span class="p">(</span><span class="mf">2</span><span class="p">),</span> <span class="n">prf</span><span class="p">(</span><span class="mf">3</span><span class="p">)</span>
+<span class="go">(714L, 80L, 617L)</span>
+</pre></div>
+<p>Since prf is a function we can of course evaluate the same
+input to get the same output:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">prf</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
+<span class="go">714L</span>
+</pre></div>
+<p>The prf can take arbitrary input:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">prf</span><span class="p">((</span><span class="s">&quot;input&quot;</span><span class="p">,</span> <span class="mf">123</span><span class="p">))</span>
+<span class="go">474L</span>
+</pre></div>
+<p>but it must be hashable:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">prf</span><span class="p">([</span><span class="s">&quot;input&quot;</span><span class="p">,</span> <span class="mf">123</span><span class="p">])</span>   <span class="c"># doctest: +IGNORE_EXCEPTION_DETAIL</span>
+<span class="gt">Traceback (most recent call last):</span>
+    <span class="o">...</span>
+<span class="nc">TypeError</span>: <span class="n-Identifier">list objects are unhashable</span>
+</pre></div>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.prss.prss">
+<!--#viff.prss.prss#--><tt class="descclassname">viff.prss.</tt><tt class="descname">prss</tt><big>(</big><em>n</em>, <em>j</em>, <em>field</em>, <em>prfs</em>, <em>key</em><big>)</big><a class="headerlink" href="#viff.prss.prss" title="Permalink to this definition">¶</a></dt>
+<dd><p>Return a pseudo-random secret share for a random number.</p>
+<p>The share is for player <em>j</em> based on the pseudo-random functions
+given in <em>prfs</em> (a mapping from subsets of players to <a title="viff.prss.PRF" class="reference" href="#viff.prss.PRF"><tt class="xref docutils literal"><span class="pre">PRF</span></tt></a>
+instances). The <em>key</em> is used when evaluating the PRFs.</p>
+<p>An example with (n,t) = (3,1) and a modulus of 31:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">field</span> <span class="k">import</span> <span class="n">GF</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">31</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prfs</span> <span class="o">=</span> <span class="p">{</span><span class="n">frozenset</span><span class="p">([</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;a&quot;</span><span class="p">,</span> <span class="mf">31</span><span class="p">),</span>
+<span class="gp">... </span>        <span class="n">frozenset</span><span class="p">([</span><span class="mf">1</span><span class="p">,</span><span class="mf">3</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;b&quot;</span><span class="p">,</span> <span class="mf">31</span><span class="p">),</span>
+<span class="gp">... </span>        <span class="n">frozenset</span><span class="p">([</span><span class="mf">2</span><span class="p">,</span><span class="mf">3</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;c&quot;</span><span class="p">,</span> <span class="mf">31</span><span class="p">)}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">1</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">{22}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">2</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">{20}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">3</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">{18}</span>
+</pre></div>
+<p>We see that the sharing is consistent because each subset of two
+players will recombine their shares to <tt class="docutils literal"><span class="pre">{24}</span></tt>.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.prss.prss_lsb">
+<!--#viff.prss.prss_lsb#--><tt class="descclassname">viff.prss.</tt><tt class="descname">prss_lsb</tt><big>(</big><em>n</em>, <em>j</em>, <em>field</em>, <em>prfs</em>, <em>key</em><big>)</big><a class="headerlink" href="#viff.prss.prss_lsb" title="Permalink to this definition">¶</a></dt>
+<dd><p>Share a pseudo-random number and its least significant bit.</p>
+<p>The random number is shared over <em>field</em> and its least significant
+bit is shared over <a title="viff.field.GF256" class="reference" href="field.html#viff.field.GF256"><tt class="xref docutils literal"><span class="pre">viff.field.GF256</span></tt></a>. It is important the
+<em>prfs</em> generate numbers much less than the size of <em>field</em> &#8211; we
+must be able to do an addition for each PRF without overflow in
+<em>field</em>.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">field</span> <span class="k">import</span> <span class="n">GF</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">23</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prfs</span> <span class="o">=</span> <span class="p">{</span><span class="n">frozenset</span><span class="p">([</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;a&quot;</span><span class="p">,</span> <span class="mf">7</span><span class="p">),</span>
+<span class="gp">... </span>        <span class="n">frozenset</span><span class="p">([</span><span class="mf">1</span><span class="p">,</span><span class="mf">3</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;b&quot;</span><span class="p">,</span> <span class="mf">7</span><span class="p">),</span>
+<span class="gp">... </span>        <span class="n">frozenset</span><span class="p">([</span><span class="mf">2</span><span class="p">,</span><span class="mf">3</span><span class="p">]):</span> <span class="n">PRF</span><span class="p">(</span><span class="s">&quot;c&quot;</span><span class="p">,</span> <span class="mf">7</span><span class="p">)}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss_lsb</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">1</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">({0}, [140])</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss_lsb</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">2</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">({15}, [3])</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">prss_lsb</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">3</span><span class="p">,</span> <span class="n">Zp</span><span class="p">,</span> <span class="n">prfs</span><span class="p">,</span> <span class="s">&quot;key&quot;</span><span class="p">)</span>
+<span class="go">({7}, [143])</span>
+</pre></div>
+<p>We see that the random value must be <tt class="docutils literal"><span class="pre">{8}</span></tt> and so the least
+significant bit must be <tt class="docutils literal"><span class="pre">[0]</span></tt>. We can check this by recombining
+any two of the three shares:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">shamir</span> <span class="k">import</span> <span class="n">recombine</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">recombine</span><span class="p">([(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">1</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">140</span><span class="p">)),</span> <span class="p">(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">2</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">3</span><span class="p">))])</span>
+<span class="go">[0]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">recombine</span><span class="p">([(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">2</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">3</span><span class="p">)),</span>   <span class="p">(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">3</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">143</span><span class="p">))])</span>
+<span class="go">[0]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">recombine</span><span class="p">([(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">3</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">143</span><span class="p">)),</span> <span class="p">(</span><span class="n">GF256</span><span class="p">(</span><span class="mf">1</span><span class="p">),</span> <span class="n">GF256</span><span class="p">(</span><span class="mf">140</span><span class="p">))])</span>
+<span class="go">[0]</span>
+</pre></div>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.prss.random_replicated_sharing">
+<!--#viff.prss.random_replicated_sharing#--><tt class="descclassname">viff.prss.</tt><tt class="descname">random_replicated_sharing</tt><big>(</big><em>j</em>, <em>prfs</em>, <em>key</em><big>)</big><a class="headerlink" href="#viff.prss.random_replicated_sharing" title="Permalink to this definition">¶</a></dt>
+<dd><p>Return a replicated sharing of a random number.</p>
+<p>The shares are for player <em>j</em> based on the pseudo-random functions
+given in <em>prfs</em> (a mapping from subsets of players to <a title="viff.prss.PRF" class="reference" href="#viff.prss.PRF"><tt class="xref docutils literal"><span class="pre">PRF</span></tt></a>
+instances). The <em>key</em> is used when evaluating the PRFs. The result
+is a list of <tt class="docutils literal"><span class="pre">(subset,</span> <span class="pre">share)</span></tt> pairs.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.prss.convert_replicated_shamir">
+<!--#viff.prss.convert_replicated_shamir#--><tt class="descclassname">viff.prss.</tt><tt class="descname">convert_replicated_shamir</tt><big>(</big><em>n</em>, <em>j</em>, <em>field</em>, <em>rep_shares</em><big>)</big><a class="headerlink" href="#viff.prss.convert_replicated_shamir" title="Permalink to this definition">¶</a></dt>
+<dd><p>Convert a set of replicated shares to a Shamir share.</p>
+<p>The conversion is done for player <em>j</em> (out of <em>n</em>) and will be
+done over <em>field</em>.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.prss.generate_subsets">
+<!--#viff.prss.generate_subsets#--><tt class="descclassname">viff.prss.</tt><tt class="descname">generate_subsets</tt><big>(</big><em>orig_set</em>, <em>size</em><big>)</big><a class="headerlink" href="#viff.prss.generate_subsets" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generates the set of all subsets of a specific size.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">generate_subsets</span><span class="p">(</span><span class="n">frozenset</span><span class="p">(</span><span class="s">&#39;abc&#39;</span><span class="p">),</span> <span class="mf">2</span><span class="p">)</span>
+<span class="go">frozenset([frozenset([&#39;c&#39;, &#39;b&#39;]), frozenset([&#39;a&#39;, &#39;c&#39;]), frozenset([&#39;a&#39;, &#39;b&#39;])])</span>
+</pre></div>
+<p>Generating subsets larger than the initial set return the empty
+set:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">generate_subsets</span><span class="p">(</span><span class="n">frozenset</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">),</span> <span class="mf">2</span><span class="p">)</span>
+<span class="go">frozenset([])</span>
+</pre></div>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="comparison.html" title="previous chapter">Comparison protocols</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="config.html" title="next chapter">Config Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/prss.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="config.html" title="Config Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="comparison.html" title="Comparison protocols" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/runtime.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,498 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Runtime Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Comparison protocols" href="comparison.html" />
+    <link rel="prev" title="Matrix Module" href="matrix.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="comparison.html" title="Comparison protocols" accesskey="N">next</a> |</li>
+          <li class="right"><a href="matrix.html" title="Matrix Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.runtime">Runtime Module<a class="headerlink" href="#module-viff.runtime" title="Permalink to this headline">¶</a></h1>
+<p>VIFF runtime. This is where the virtual ideal functionality is
+hiding! The runtime is responsible for sharing inputs, handling
+communication, and running the calculations.</p>
+<p>Each player participating in the protocol will instantiate a
+<a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> object and use it for the calculations.</p>
+<p>The Runtime returns <a title="viff.runtime.Share" class="reference" href="#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a> objects for most operations, and
+these can be added, subtracted, and multiplied as normal thanks to
+overloaded arithmetic operators. The runtime will take care of
+scheduling things correctly behind the scenes.</p>
+<dl class="class">
+<dt id="viff.runtime.Share">
+<!--#viff.runtime.Share#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">Share</tt><big>(</big><em>runtime</em>, <em>field</em>, <em>value=None</em><big>)</big><a class="headerlink" href="#viff.runtime.Share" title="Permalink to this definition">¶</a></dt>
+<dd><p>A shared number.</p>
+<p>The <a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> operates on shares, represented by this class.
+Shares are asynchronous in the sense that they promise to attain a
+value at some point in the future.</p>
+<p>Shares overload the arithmetic operations so that <tt class="docutils literal"><span class="pre">x</span> <span class="pre">=</span> <span class="pre">a</span> <span class="pre">+</span> <span class="pre">b</span></tt>
+will create a new share <em>x</em>, which will eventually contain the
+sum of <em>a</em> and <em>b</em>. Each share is associated with a
+<a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> and the arithmetic operations simply call back to
+that runtime.</p>
+<dl class="method">
+<dt id="viff.runtime.Share.clone">
+<!--#viff.runtime.Share.clone#--><tt class="descname">clone</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.runtime.Share.clone" title="Permalink to this definition">¶</a></dt>
+<dd><p>Clone a share.</p>
+<p>Works like <tt class="xref docutils literal"><span class="pre">util.clone_deferred()</span></tt> except that it returns a new
+<a title="viff.runtime.Share" class="reference" href="#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a> instead of a <tt class="xref docutils literal"><span class="pre">Deferred</span></tt>.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="viff.runtime.ShareList">
+<!--#viff.runtime.ShareList#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">ShareList</tt><big>(</big><em>shares</em>, <em>threshold=None</em><big>)</big><a class="headerlink" href="#viff.runtime.ShareList" title="Permalink to this definition">¶</a></dt>
+<dd><p>Create a share that waits on a number of other shares.</p>
+<p>Roughly modelled after the Twisted <tt class="xref docutils literal"><span class="pre">DeferredList</span></tt>
+class. The advantage of this class is that it is a <a title="viff.runtime.Share" class="reference" href="#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a>
+(not just a <tt class="xref docutils literal"><span class="pre">Deferred</span></tt>) and that it can be made to trigger
+when a certain threshold of the shares are ready. This example
+shows how the <tt class="xref docutils literal"><span class="pre">pprint()</span></tt> callback is triggered when <em>a</em> and
+<em>c</em> are ready:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pprint</span> <span class="k">import</span> <span class="n">pprint</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">viff.field</span> <span class="k">import</span> <span class="n">GF256</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Share</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">GF256</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Share</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">GF256</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Share</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">GF256</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">shares</span> <span class="o">=</span> <span class="n">ShareList</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">],</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">2</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">shares</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">pprint</span><span class="p">)</span>           <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;ShareList at 0x...&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="o">.</span><span class="n">callback</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span><span class="o">.</span><span class="n">callback</span><span class="p">(</span><span class="mf">20</span><span class="p">)</span>
+<span class="go">[(True, 10), None, (True, 20)]</span>
+</pre></div>
+<p>The <tt class="xref docutils literal"><span class="pre">pprint()</span></tt> function is called with a list of pairs. The first
+component of each pair is a boolean indicating if the callback or
+errback method was called on the corresponding <a title="viff.runtime.Share" class="reference" href="#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a>, and
+the second component is the value given to the callback/errback.</p>
+<p>If a threshold less than the full number of shares is used, some
+of the pairs may be missing and <tt class="xref xref docutils literal"><span class="pre">None</span></tt> is used instead. In
+the example above the <em>b</em> share arrived later than <em>a</em> and <em>c</em>,
+and so the list contains a <tt class="xref xref docutils literal"><span class="pre">None</span></tt> on its place.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="viff.runtime.ShareExchanger">
+<!--#viff.runtime.ShareExchanger#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">ShareExchanger</tt><a class="headerlink" href="#viff.runtime.ShareExchanger" title="Permalink to this definition">¶</a></dt>
+<dd><p>Send and receive shares.</p>
+<p>All players are connected by pair-wise connections and this
+Twisted protocol is one such connection. It is used to send and
+receive shares from one other player.</p>
+<p>The <tt class="xref docutils literal"><span class="pre">marshal</span></tt> module is used for converting the data to bytes
+for the network and to convert back again to structured data.</p>
+<dl class="attribute">
+<dt id="viff.runtime.ShareExchanger.incoming_data">
+<!--#viff.runtime.ShareExchanger.incoming_data#--><tt class="descname">incoming_data</tt><a class="headerlink" href="#viff.runtime.ShareExchanger.incoming_data" title="Permalink to this definition">¶</a></dt>
+<dd>Data from our peer is put here, either as an empty
+<tt class="xref docutils literal"><span class="pre">Deferred</span></tt> if we are waiting on input from the player,
+or the data itself if data is received from the other player
+before we are ready to use it.</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ShareExchanger.sendShare">
+<!--#viff.runtime.ShareExchanger.sendShare#--><tt class="descname">sendShare</tt><big>(</big><em>program_counter</em>, <em>share</em><big>)</big><a class="headerlink" href="#viff.runtime.ShareExchanger.sendShare" title="Permalink to this definition">¶</a></dt>
+<dd><p>Send a share.</p>
+<p>The program counter and the share are marshalled and sent to
+the peer.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ShareExchanger.loseConnection">
+<!--#viff.runtime.ShareExchanger.loseConnection#--><tt class="descname">loseConnection</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.runtime.ShareExchanger.loseConnection" title="Permalink to this definition">¶</a></dt>
+<dd>Disconnect this protocol instance.</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.runtime.increment_pc">
+<!--#viff.runtime.increment_pc#--><tt class="descclassname">viff.runtime.</tt><tt class="descname">increment_pc</tt><big>(</big><em>method</em><big>)</big><a class="headerlink" href="#viff.runtime.increment_pc" title="Permalink to this definition">¶</a></dt>
+<dd><p>Make <em>method</em> automatically increment the program counter.</p>
+<p>Adding this decorator to a <a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> method will ensure
+that the program counter is incremented correctly when entering
+the method.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.runtime.create_runtime">
+<!--#viff.runtime.create_runtime#--><tt class="descclassname">viff.runtime.</tt><tt class="descname">create_runtime</tt><big>(</big><em>id</em>, <em>players</em>, <em>threshold</em>, <em>options=None</em>, <em>runtime_class=&lt;class viff.runtime.Runtime at 0x95786ec&gt;</em><big>)</big><a class="headerlink" href="#viff.runtime.create_runtime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Create a <a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> and connect to the other players.</p>
+<p>This function should be used in normal programs instead of
+instantiating the Runtime directly. This function makes sure that
+the Runtime is correctly connected to the other players.</p>
+<p>The return value is a Deferred which will trigger when the runtime
+is ready. Add your protocol as a callback on this Deferred using
+code like this:</p>
+<div class="highlight"><pre><span class="k">def</span> <span class="nf">protocol</span><span class="p">(</span><span class="n">runtime</span><span class="p">):</span>
+    <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">shamir_share</span><span class="p">([</span><span class="mf">1</span><span class="p">,</span> <span class="mf">2</span><span class="p">,</span> <span class="mf">3</span><span class="p">],</span> <span class="n">Zp</span><span class="p">,</span> <span class="nb">input</span><span class="p">)</span>
+
+    <span class="n">a</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
+    <span class="n">b</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">b</span><span class="p">)</span>
+    <span class="n">c</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
+
+    <span class="n">dprint</span><span class="p">(</span><span class="s">&quot;Opened a: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span>
+    <span class="n">dprint</span><span class="p">(</span><span class="s">&quot;Opened b: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
+    <span class="n">dprint</span><span class="p">(</span><span class="s">&quot;Opened c: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span>
+
+    <span class="n">runtime</span><span class="o">.</span><span class="n">wait_for</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">,</span><span class="n">c</span><span class="p">)</span>
+
+<span class="n">pre_runtime</span> <span class="o">=</span> <span class="n">create_runtime</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">players</span><span class="p">,</span> <span class="mf">1</span><span class="p">)</span>
+<span class="n">pre_runtime</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">protocol</span><span class="p">)</span>
+</pre></div>
+<p>This is the general template which VIFF programs should follow.
+Please see the example applications for more examples.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="viff.runtime.BasicRuntime">
+<!--#viff.runtime.BasicRuntime#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">BasicRuntime</tt><big>(</big><em>player</em>, <em>threshold</em>, <em>options=None</em><big>)</big><a class="headerlink" href="#viff.runtime.BasicRuntime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Basic VIFF runtime with no crypto.</p>
+<p>This runtime contains only the most basic operations needed such
+as the program counter, the list of other players, etc.</p>
+<dl class="attribute">
+<dt id="viff.runtime.BasicRuntime.id">
+<!--#viff.runtime.BasicRuntime.id#--><tt class="descname">id</tt><a class="headerlink" href="#viff.runtime.BasicRuntime.id" title="Permalink to this definition">¶</a></dt>
+<dd>Player ID. This is an integer in the range 1&#8211;<em>n</em> for <em>n</em>
+players.</dd></dl>
+
+<dl class="attribute">
+<dt id="viff.runtime.BasicRuntime.threshold">
+<!--#viff.runtime.BasicRuntime.threshold#--><tt class="descname">threshold</tt><a class="headerlink" href="#viff.runtime.BasicRuntime.threshold" title="Permalink to this definition">¶</a></dt>
+<dd>Default threshold used by <a title="viff.runtime.Runtime.shamir_share" class="reference" href="#viff.runtime.Runtime.shamir_share"><tt class="xref docutils literal"><span class="pre">Runtime.shamir_share()</span></tt></a>,
+<a title="viff.runtime.Runtime.open" class="reference" href="#viff.runtime.Runtime.open"><tt class="xref docutils literal"><span class="pre">Runtime.open()</span></tt></a>, and others.</dd></dl>
+
+<dl class="attribute">
+<dt id="viff.runtime.BasicRuntime.program_counter">
+<!--#viff.runtime.BasicRuntime.program_counter#--><tt class="descname">program_counter</tt><a class="headerlink" href="#viff.runtime.BasicRuntime.program_counter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Whenever a share is sent over the network, it must be
+uniquely identified so that the receiving player known what
+operation the share is a result of. This is done by
+associating a <em>program counter</em> with each operation.</p>
+<p>Keeping the program counter synchronized between all players
+ought to be easy, but because of the asynchronous nature of
+network protocols, all players might not reach the same parts
+of the program at the same time.</p>
+<p>Consider two players <em>A</em> and <em>B</em> who are both waiting on the
+variables <em>a</em> and <em>b</em>. Callbacks have been added to <em>a</em> and
+<em>b</em>, and the question is what program counter the callbacks
+should use when sending data out over the network.</p>
+<p>Let <em>A</em> receive input for <em>a</em> and then for <em>b</em> a little
+later, and let <em>B</em> receive the inputs in reversed order so
+that the input for <em>b</em> arrives first. The goal is to keep the
+program counters synchronized so that program counter <em>x</em>
+refers to the same operation on all players. Because the
+inputs arrive in different order at different players,
+incrementing a simple global counter is not enough.</p>
+<p>Instead, a <em>tree</em> is made, which follows the tree of
+execution. At the top level the program counter starts at
+<tt class="docutils literal"><span class="pre">[0]</span></tt>. At the next operation it becomes <tt class="docutils literal"><span class="pre">[1]</span></tt>, and so on.
+If a callback is scheduled (see <a title="viff.runtime.BasicRuntime.schedule_callback" class="reference" href="#viff.runtime.BasicRuntime.schedule_callback"><tt class="xref docutils literal"><span class="pre">schedule_callback()</span></tt></a>) at
+program counter <tt class="docutils literal"><span class="pre">[x,</span> <span class="pre">y,</span> <span class="pre">z]</span></tt>, any calls it makes will be
+numbered <tt class="docutils literal"><span class="pre">[x,</span> <span class="pre">y,</span> <span class="pre">z,</span> <span class="pre">1]</span></tt>, then <tt class="docutils literal"><span class="pre">[x,</span> <span class="pre">y,</span> <span class="pre">z,</span> <span class="pre">2]</span></tt>, and so on.</p>
+<p>Maintaining such a tree of program counters ensures that
+different parts of the program execution never reuses the
+same program counter for different variables.</p>
+<p>The <a title="viff.runtime.increment_pc" class="reference" href="#viff.runtime.increment_pc"><tt class="xref docutils literal"><span class="pre">increment_pc()</span></tt></a> decorator is responsible for
+dynamically building the tree as the execution unfolds and
+<a title="viff.runtime.BasicRuntime.schedule_callback" class="reference" href="#viff.runtime.BasicRuntime.schedule_callback"><tt class="xref docutils literal"><span class="pre">schedule_callback()</span></tt></a> is responsible for scheduling
+callbacks with the correct program counter.</p>
+<p>See <a class="reference" href="program-counters.html#program-counters"><em>Program Counters</em></a> for more background information.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="viff.runtime.BasicRuntime.add_options">
+<!--#viff.runtime.BasicRuntime.add_options#--><tt class="descname">add_options</tt><a class="headerlink" href="#viff.runtime.BasicRuntime.add_options" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.BasicRuntime.preprocess">
+<!--#viff.runtime.BasicRuntime.preprocess#--><tt class="descname">preprocess</tt><big>(</big><em>program</em><big>)</big><a class="headerlink" href="#viff.runtime.BasicRuntime.preprocess" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate preprocess material.</p>
+<p>The <em>program</em> specifies which methods to call and with which
+arguments. The generator methods called must adhere to the
+following interface:</p>
+<ul class="simple">
+<li>They must return a <tt class="docutils literal"><span class="pre">(int,</span> <span class="pre">Deferred)</span></tt> tuple where the
+<tt class="docutils literal"><span class="pre">int</span></tt> tells us how many items of pre-processed data the
+<tt class="xref docutils literal"><span class="pre">Deferred</span></tt> will yield.</li>
+<li>The Deferred must yield a list of the promissed length.</li>
+<li>The list contains the actual data. This data can be either a
+Deferred or a tuple of Deferreds.</li>
+</ul>
+<p>The <a title="viff.runtime.ActiveRuntime.generate_triples" class="reference" href="#viff.runtime.ActiveRuntime.generate_triples"><tt class="xref docutils literal"><span class="pre">ActiveRuntime.generate_triples()</span></tt></a> method is an
+example of a method fulfilling this interface.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.BasicRuntime.schedule_callback">
+<!--#viff.runtime.BasicRuntime.schedule_callback#--><tt class="descname">schedule_callback</tt><big>(</big><em>deferred</em>, <em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#viff.runtime.BasicRuntime.schedule_callback" title="Permalink to this definition">¶</a></dt>
+<dd><p>Schedule a callback on a deferred with the correct program
+counter.</p>
+<p>If a callback depends on the current program counter, then use
+this method to schedule it instead of simply calling
+addCallback directly. Simple callbacks that are independent of
+the program counter can still be added directly to the
+Deferred as usual.</p>
+<p>Any extra arguments are passed to the callback as with
+<tt class="xref docutils literal"><span class="pre">addCallback()</span></tt>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.BasicRuntime.shutdown">
+<!--#viff.runtime.BasicRuntime.shutdown#--><tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#viff.runtime.BasicRuntime.shutdown" title="Permalink to this definition">¶</a></dt>
+<dd><p>Shutdown the runtime.</p>
+<p>All connections are closed and the runtime cannot be used
+again after this has been called.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.BasicRuntime.wait_for">
+<!--#viff.runtime.BasicRuntime.wait_for#--><tt class="descname">wait_for</tt><big>(</big><em>*vars</em><big>)</big><a class="headerlink" href="#viff.runtime.BasicRuntime.wait_for" title="Permalink to this definition">¶</a></dt>
+<dd><p>Make the runtime wait for the variables given.</p>
+<p>The runtime is shut down when all variables are calculated.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="viff.runtime.Runtime">
+<!--#viff.runtime.Runtime#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">Runtime</tt><big>(</big><em>player</em>, <em>threshold</em>, <em>options=None</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime" title="Permalink to this definition">¶</a></dt>
+<dd><p>The VIFF runtime.</p>
+<p>The runtime is used for sharing values (<a title="viff.runtime.Runtime.shamir_share" class="reference" href="#viff.runtime.Runtime.shamir_share"><tt class="xref docutils literal"><span class="pre">shamir_share()</span></tt></a> or
+<a title="viff.runtime.Runtime.prss_share" class="reference" href="#viff.runtime.Runtime.prss_share"><tt class="xref docutils literal"><span class="pre">prss_share()</span></tt></a>) into <a title="viff.runtime.Share" class="reference" href="#viff.runtime.Share"><tt class="xref docutils literal"><span class="pre">Share</span></tt></a> object and opening such
+shares (<a title="viff.runtime.Runtime.open" class="reference" href="#viff.runtime.Runtime.open"><tt class="xref docutils literal"><span class="pre">open()</span></tt></a>) again. Calculations on shares is normally
+done through overloaded arithmetic operations, but it is also
+possible to call <a title="viff.runtime.Runtime.add" class="reference" href="#viff.runtime.Runtime.add"><tt class="xref docutils literal"><span class="pre">add()</span></tt></a>, <a title="viff.runtime.Runtime.mul" class="reference" href="#viff.runtime.Runtime.mul"><tt class="xref docutils literal"><span class="pre">mul()</span></tt></a>, etc. directly if one
+prefers.</p>
+<p>Each player in the protocol uses a <a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> object. To
+create an instance and connect it correctly with the other
+players, please use the <a title="viff.runtime.create_runtime" class="reference" href="#viff.runtime.create_runtime"><tt class="xref docutils literal"><span class="pre">create_runtime()</span></tt></a> function instead of
+instantiating a Runtime directly. The <a title="viff.runtime.create_runtime" class="reference" href="#viff.runtime.create_runtime"><tt class="xref docutils literal"><span class="pre">create_runtime()</span></tt></a>
+function will take care of setting up network connections and
+return a <tt class="xref docutils literal"><span class="pre">Deferred</span></tt> which triggers with the
+<a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> object when it is ready.</p>
+<dl class="method">
+<dt id="viff.runtime.Runtime.add">
+<!--#viff.runtime.Runtime.add#--><tt class="descname">add</tt><big>(</big><em>share_a</em>, <em>share_b</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.add" title="Permalink to this definition">¶</a></dt>
+<dd><p>Addition of shares.</p>
+<p>Communication cost: none.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.mul">
+<!--#viff.runtime.Runtime.mul#--><tt class="descname">mul</tt><big>(</big><em>share_a</em>, <em>share_b</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.mul" title="Permalink to this definition">¶</a></dt>
+<dd><p>Multiplication of shares.</p>
+<p>Communication cost: 1 Shamir sharing.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.open">
+<!--#viff.runtime.Runtime.open#--><tt class="descname">open</tt><big>(</big><em>share</em>, <em>receivers=None</em>, <em>threshold=None</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.open" title="Permalink to this definition">¶</a></dt>
+<dd><p>Open a secret sharing.</p>
+<p>The <em>receivers</em> are the players that will eventually obtain
+the opened result. The default is to let everybody know the
+result. By default the <tt class="xref docutils literal"><span class="pre">threshold</span></tt> + 1 shares are
+reconstructed, but <em>threshold</em> can be used to override this.</p>
+<p>Communication cost: every player sends one share to each
+receiving player.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.prss_shamir_share_bit_double">
+<!--#viff.runtime.Runtime.prss_shamir_share_bit_double#--><tt class="descname">prss_shamir_share_bit_double</tt><big>(</big><em>field</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.prss_shamir_share_bit_double" title="Permalink to this definition">¶</a></dt>
+<dd>Shamir share a random bit over <em>field</em> and GF256.</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.prss_share">
+<!--#viff.runtime.Runtime.prss_share#--><tt class="descname">prss_share</tt><big>(</big><em>inputters</em>, <em>field</em>, <em>element=None</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.prss_share" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates pseudo-random secret sharings.</p>
+<p>This protocol creates a secret sharing for each player in the
+subset of players specified in <em>inputters</em>. Each inputter
+provides an integer. The result is a list of shares, one for
+each inputter.</p>
+<p>The protocol uses the pseudo-random secret sharing technique
+described in the paper &#8220;Share Conversion, Pseudorandom
+Secret-Sharing and Applications to Secure Computation&#8221; by
+Ronald Cramer, Ivan Damgård, and Yuval Ishai in Proc. of TCC
+2005, LNCS 3378. <a class="reference" href="http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps">Download</a></p>
+<p>Communication cost: Each inputter does one broadcast.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.prss_share_bit_double">
+<!--#viff.runtime.Runtime.prss_share_bit_double#--><tt class="descname">prss_share_bit_double</tt><big>(</big><em>field</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.prss_share_bit_double" title="Permalink to this definition">¶</a></dt>
+<dd><p>Share a random bit over <em>field</em> and GF256.</p>
+<p>The protocol is described in &#8220;Efficient Conversion of
+Secret-shared Values Between Different Fields&#8221; by Ivan Damgård
+and Rune Thorbek available as <a class="reference" href="http://eprint.iacr.org/2008/221">Cryptology ePrint Archive,
+Report 2008/221</a>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.prss_share_random">
+<!--#viff.runtime.Runtime.prss_share_random#--><tt class="descname">prss_share_random</tt><big>(</big><em>field</em>, <em>binary=False</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.prss_share_random" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate shares of a uniformly random element from the field given.</p>
+<p>If binary is True, a 0/1 element is generated. No player
+learns the value of the element.</p>
+<p>Communication cost: none if binary=False, 1 open otherwise.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.shamir_share">
+<!--#viff.runtime.Runtime.shamir_share#--><tt class="descname">shamir_share</tt><big>(</big><em>inputters</em>, <em>field</em>, <em>number=None</em>, <em>threshold=None</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.shamir_share" title="Permalink to this definition">¶</a></dt>
+<dd><p>Secret share <em>number</em> over <em>field</em> using Shamir&#8217;s method.</p>
+<p>The number is shared using polynomial of degree <em>threshold</em>
+(defaults to <tt class="xref docutils literal"><span class="pre">threshold</span></tt>). Returns a list of shares
+unless unless there is only one inputter in which case the
+share is returned directly.</p>
+<p>Communication cost: n elements transmitted.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.Runtime.sub">
+<!--#viff.runtime.Runtime.sub#--><tt class="descname">sub</tt><big>(</big><em>share_a</em>, <em>share_b</em><big>)</big><a class="headerlink" href="#viff.runtime.Runtime.sub" title="Permalink to this definition">¶</a></dt>
+<dd><p>Subtraction of shares.</p>
+<p>Communication cost: none.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="viff.runtime.ActiveRuntime">
+<!--#viff.runtime.ActiveRuntime#-->class <tt class="descclassname">viff.runtime.</tt><tt class="descname">ActiveRuntime</tt><big>(</big><em>player</em>, <em>threshold</em>, <em>options=None</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime" title="Permalink to this definition">¶</a></dt>
+<dd><p>A runtime secure against active adversaries.</p>
+<p>This class currently inherits most of its functionality from the
+normal <a title="viff.runtime.Runtime" class="reference" href="#viff.runtime.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> class and is thus <strong>not</strong> yet secure.</p>
+<dl class="method">
+<dt id="viff.runtime.ActiveRuntime.mul">
+<!--#viff.runtime.ActiveRuntime.mul#--><tt class="descname">mul</tt><big>(</big><em>share_x</em>, <em>share_y</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime.mul" title="Permalink to this definition">¶</a></dt>
+<dd><p>Multiplication of shares.</p>
+<p>Preprocessing: 1 multiplication triple.
+Communication: 2 openings.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ActiveRuntime.single_share_random">
+<!--#viff.runtime.ActiveRuntime.single_share_random#--><tt class="descname">single_share_random</tt><big>(</big><em>T</em>, <em>degree</em>, <em>field</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime.single_share_random" title="Permalink to this definition">¶</a></dt>
+<dd><p>Share a random secret.</p>
+<p>The guarantee is that a number of shares are made and out of
+those, the <em>T</em> that are returned by this method will be
+correct sharings of a random number using <em>degree</em> as the
+polynomial degree.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ActiveRuntime.double_share_random">
+<!--#viff.runtime.ActiveRuntime.double_share_random#--><tt class="descname">double_share_random</tt><big>(</big><em>T</em>, <em>d1</em>, <em>d2</em>, <em>field</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime.double_share_random" title="Permalink to this definition">¶</a></dt>
+<dd><p>Double-share a random secret using two polynomials.</p>
+<p>The guarantee is that a number of shares are made and out of
+those, the <em>T</em> that are returned by this method will be correct
+double-sharings of a random number using <em>d1</em> and <em>d2</em> as the
+polynomial degrees.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ActiveRuntime.generate_triples">
+<!--#viff.runtime.ActiveRuntime.generate_triples#--><tt class="descname">generate_triples</tt><big>(</big><em>field</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime.generate_triples" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate multiplication triples.</p>
+<p>These are random numbers <em>a</em>, <em>b</em>, and <em>c</em> such that <tt class="docutils literal"><span class="pre">c</span> <span class="pre">=</span>
+<span class="pre">ab</span></tt>. This function can be used in pre-processing.</p>
+<p>Returns a tuple with the number of triples generated and a
+Deferred which will yield a list of 3-tuples.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="viff.runtime.ActiveRuntime.broadcast">
+<!--#viff.runtime.ActiveRuntime.broadcast#--><tt class="descname">broadcast</tt><big>(</big><em>senders</em>, <em>message=None</em><big>)</big><a class="headerlink" href="#viff.runtime.ActiveRuntime.broadcast" title="Permalink to this definition">¶</a></dt>
+<dd><p>Perform one or more Bracha broadcast(s).</p>
+<p>The list of <em>senders</em> given will determine the subset of players
+who wish to broadcast a message. If this player wishes to
+broadcast, its ID must be in the list of senders and the
+optional <em>message</em> parameter must be used.</p>
+<p>If the list of senders consists only of a single sender, the
+result will be a single element, otherwise it will be a list.</p>
+<p>A Bracha broadcast is reliable against an active adversary
+corrupting up to t &lt; n/3 of the players. For more details, see
+the paper &#8220;An asynchronous [(n-1)/3]-resilient consensus
+protocol&#8221; by G. Bracha in Proc. 3rd ACM Symposium on
+Principles of Distributed Computing, 1984, pages 154-162.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="matrix.html" title="previous chapter">Matrix Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="comparison.html" title="next chapter">Comparison protocols</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/runtime.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="comparison.html" title="Comparison protocols" accesskey="N">next</a> |</li>
+          <li class="right"><a href="matrix.html" title="Matrix Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/search.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Search &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <script type="text/javascript" src="_static/searchtools.js"></script>
+
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1 id="search-documentation">Search</h1>
+  <p>
+    From here you can search these documents. Enter your search
+    words into the box below and click "search". Note that the search
+    function will automatically search for all of the words. Pages
+    containing less words won't appear in the result list.
+  </p>
+  <form action="" method="get">
+    <input type="text" name="q" value="" />
+    <input type="submit" value="search" />
+  </form>
+  
+  <div id="search-results">
+  
+  </div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/shamir.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Shamir Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Matrix Module" href="matrix.html" />
+    <link rel="prev" title="Finite Fields Module" href="field.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="matrix.html" title="Matrix Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="field.html" title="Finite Fields Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.shamir">Shamir Module<a class="headerlink" href="#module-viff.shamir" title="Permalink to this headline">¶</a></h1>
+<p>Shamir secret sharing and recombination. Based on the paper <em>How to
+share a secret</em> by Adi Shamir in <em>Communications of the ACM</em> <strong>22</strong>
+(11): 612-613.</p>
+<dl class="function">
+<dt id="viff.shamir.recombine">
+<!--#viff.shamir.recombine#--><tt class="descclassname">viff.shamir.</tt><tt class="descname">recombine</tt><big>(</big><em>shares</em>, <em>x_recomb=0</em><big>)</big><a class="headerlink" href="#viff.shamir.recombine" title="Permalink to this definition">¶</a></dt>
+<dd><p>Recombines list of <tt class="docutils literal"><span class="pre">(xi,</span> <span class="pre">yi)</span></tt> pairs.</p>
+<p>Shares is a list of <em>threshold</em> + 1 <tt class="docutils literal"><span class="pre">(player</span> <span class="pre">id,</span> <span class="pre">share)</span></tt> pairs.
+Recombination is done in the optional point <em>x_recomb</em>.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.shamir.share">
+<!--#viff.shamir.share#--><tt class="descclassname">viff.shamir.</tt><tt class="descname">share</tt><big>(</big><em>secret</em>, <em>threshold</em>, <em>num_players</em><big>)</big><a class="headerlink" href="#viff.shamir.share" title="Permalink to this definition">¶</a></dt>
+<dd><p>Shamir share secret.</p>
+<p>The <em>threshold</em> indicates the maximum number of shares that reveal
+nothing about <em>secret</em>. The return value is a list of <tt class="docutils literal"><span class="pre">(player</span>
+<span class="pre">id,</span> <span class="pre">share)</span></tt> pairs.</p>
+<p>It holds that sharing and recombination cancels each other:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">field</span> <span class="k">import</span> <span class="n">GF</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">47</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">secret</span> <span class="o">=</span> <span class="n">Zp</span><span class="p">(</span><span class="mf">42</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">recombine</span><span class="p">(</span><span class="n">share</span><span class="p">(</span><span class="n">secret</span><span class="p">,</span> <span class="mf">7</span><span class="p">,</span> <span class="mf">15</span><span class="p">)[:</span><span class="mf">8</span><span class="p">])</span> <span class="o">==</span> <span class="n">secret</span>
+<span class="go">True</span>
+</pre></div>
+<p>The threshold can range from zero (for a dummy-sharing):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">share</span><span class="p">(</span><span class="n">Zp</span><span class="p">(</span><span class="mf">10</span><span class="p">),</span> <span class="mf">0</span><span class="p">,</span> <span class="mf">5</span><span class="p">)</span>
+<span class="go">[({1}, {10}), ({2}, {10}), ({3}, {10}), ({4}, {10}), ({5}, {10})]</span>
+</pre></div>
+<p>up to but not including <em>num_players</em>:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">share</span><span class="p">(</span><span class="n">Zp</span><span class="p">(</span><span class="mf">10</span><span class="p">),</span> <span class="mf">5</span><span class="p">,</span> <span class="mf">5</span><span class="p">)</span>
+<span class="gt">Traceback (most recent call last):</span>
+<span class="c">...</span>
+<span class="nc">AssertionError</span>: <span class="n-Identifier">Threshold out of range</span>
+</pre></div>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.shamir.verify_sharing">
+<!--#viff.shamir.verify_sharing#--><tt class="descclassname">viff.shamir.</tt><tt class="descname">verify_sharing</tt><big>(</big><em>shares</em>, <em>degree</em><big>)</big><a class="headerlink" href="#viff.shamir.verify_sharing" title="Permalink to this definition">¶</a></dt>
+<dd><p>Verifies that a sharing is correct.</p>
+<p>It is verified that the given shares correspond to points on a
+polynomial of at most the given degree.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">field</span> <span class="k">import</span> <span class="n">GF</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Zp</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">47</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">shares</span> <span class="o">=</span> <span class="p">[(</span><span class="n">Zp</span><span class="p">(</span><span class="n">i</span><span class="p">),</span> <span class="n">Zp</span><span class="p">(</span><span class="n">i</span><span class="o">**</span><span class="mf">2</span><span class="p">))</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">1</span><span class="p">,</span> <span class="mf">6</span><span class="p">)]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">shares</span>
+<span class="go">[({1}, {1}), ({2}, {4}), ({3}, {9}), ({4}, {16}), ({5}, {25})]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">verify_sharing</span><span class="p">(</span><span class="n">shares</span><span class="p">,</span> <span class="mf">2</span><span class="p">)</span>
+<span class="go">True</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">verify_sharing</span><span class="p">(</span><span class="n">shares</span><span class="p">,</span> <span class="mf">1</span><span class="p">)</span>
+<span class="go">False</span>
+</pre></div>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="field.html" title="previous chapter">Finite Fields Module</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="matrix.html" title="next chapter">Matrix Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/shamir.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="matrix.html" title="Matrix Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="field.html" title="Finite Fields Module" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/unit-testing.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,341 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Unit Testing &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Implementation" href="implementation.html" />
+    <link rel="prev" title="Developer&#8217;s Guide" href="development.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="N">next</a> |</li>
+          <li class="right"><a href="development.html" title="Developer&#8217;s Guide" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="unit-testing">Unit Testing<a class="headerlink" href="#unit-testing" title="Permalink to this headline">¶</a></h1>
+<p>VIFF employs a set of unit tests to help developers catch regressions
+and to ensure the correctness of the implementation. The code is
+continuously tested using a <a class="reference" href="http://buildbot.net/">BuildBot</a> and the results are available
+<a class="reference" href="http://buildbot.viff.dk/">online</a>. If you see warnings or errors from the unit tests on the
+<a class="reference" href="http://buildbot.viff.dk/waterfall">BuildBot waterfall page</a>, then please take it as an invitation to
+fix them!</p>
+<p>When using Twisted it is natural to use its unit testing framework
+called <a class="reference" href="http://twistedmatrix.com/trac/wiki/TwistedTrial">Trial</a>. Trial has the big advantage over normal testing
+frameworks that it understands Twisted&#8217;s <a class="reference" href="http://twistedmatrix.com/projects/core/documentation/howto/defer.html">Deferreds</a> — if a unit test
+returns a Deferred, Trial waits for it to trigger before it declares
+the test a success or failure. Please refer to this <a class="reference" href="http://twistedmatrix.com/trac/browser/branches/trial-tutorial-2443/doc/core/howto/trial.xhtml?format=raw">tutorial</a> for more
+information.</p>
+<div class="section">
+<h2 id="running-the-unit-tests">Running the Unit Tests<a class="headerlink" href="#running-the-unit-tests" title="Permalink to this headline">¶</a></h2>
+<p>To run the VIFF unit tests you must make sure that <tt class="docutils literal"><span class="pre">import</span> <span class="pre">viff</span></tt>
+works correctly in Python. In other words, you must make sure that
+VIFF is installed or that the root of your source tree is in
+<tt class="docutils literal"><span class="pre">PYTHONPATH</span></tt>. You can test this by changing to some unrelated
+directory, starting an interactive Python session and run:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">import</span> <span class="nn">viff</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">viff</span><span class="o">.</span><span class="n">__version__</span>
+<span class="go">0.3</span>
+</pre></div>
+<p>If it fails with an ImportError, then please double-check that your
+<tt class="docutils literal"><span class="pre">PYTHONPATH</span></tt> is setup correctly.</p>
+<p>Now simply execute <tt class="docutils literal"><span class="pre">trial</span> <span class="pre">viff</span></tt> to run the unit tests. You should
+get output similar to this:</p>
+<pre>% trial viff
+Seeding random generator with random seed 4658
+Running 65 tests.
+viff.test.test_active_runtime
+  ActiveRuntimeTest
+    test_broadcast ...                                           [OK]
+viff.test.test_basic_runtime
+  ProgramCounterTest
+    test_callback ...                                            [OK]
+    test_complex_operation ...                                   [OK]
+    test_initial_value ...                                       [OK]
+    test_multiple_callbacks ...                             [SKIPPED]
+    test_nested_calls ...                                        [OK]
+    test_simple_operation ...                                    [OK]
+viff.test.test_field
+  GF256TestCase
+    test_add ...                                                 [OK]
+    test_construct ...                                           [OK]
+    test_div ...                                                 [OK]
+    test_field ...                                               [OK]
+    test_invert ...                                              [OK]
+    test_mul ...                                                 [OK]
+    test_neg ...                                                 [OK]
+    test_pow ...                                                 [OK]
+    test_str ...                                                 [OK]
+    test_sub ...                                                 [OK]
+    test_xor ...                                                 [OK]
+  GFpElementTestCase
+    test_add ...                                                 [OK]
+    test_bit ...                                                 [OK]
+    test_div ...                                                 [OK]
+    test_field ...                                               [OK]
+    test_invert ...                                              [OK]
+    test_mul ...                                                 [OK]
+    test_neg ...                                                 [OK]
+    test_sqrt ...                                                [OK]
+    test_str ...                                                 [OK]
+    test_sub ...                                                 [OK]
+doctest
+  DocTestCase
+    field ...                                                    [OK]
+    GF ...                                                       [OK]
+    __eq__ ...                                                   [OK]
+    __init__ ...                                                 [OK]
+    __nonzero__ ...                                              [OK]
+    __radd__ ...                                                 [OK]
+    __rmul__ ...                                                 [OK]
+viff.test.test_prss
+  PRSSTestCase
+    test_generate_subsets ...                                    [OK]
+doctest
+  DocTestCase
+    PRF ...                                                      [OK]
+    __call__ ...                                                 [OK]
+    __init__ ...                                                 [OK]
+    generate_subsets ...                                         [OK]
+    prss ...                                                     [OK]
+viff.test.test_runtime
+  RuntimeTest
+    test_add ...                                                 [OK]
+    test_add_coerce ...                                          [OK]
+    test_convert_bit_share ...                                   [OK]
+    test_greater_than ...                                        [OK]
+    test_greater_than_equal ...                                  [OK]
+    test_greater_than_equalII ...                                [OK]
+    test_less_than ...                                           [OK]
+    test_less_than_equal ...                                     [OK]
+    test_mul ...                                                 [OK]
+    test_open ...                                                [OK]
+    test_open_no_mutate ...                                      [OK]
+    test_prss_share_bit ...                                      [OK]
+    test_prss_share_int ...                                      [OK]
+    test_prss_share_random_bit ...                               [OK]
+    test_prss_share_random_int ...                               [OK]
+    test_shamir_share ...                                        [OK]
+    test_shamir_share_asymmetric ...                             [OK]
+    test_sub ...                                                 [OK]
+    test_sub_coerce ...                                          [OK]
+    test_xor ...                                                 [OK]
+doctest
+  DocTestCase
+    share ...                                                    [OK]
+    clone_deferred ...                                           [OK]
+    dlift ...                                                    [OK]
+    find_prime ...                                               [OK]
+
+=====================================================================
+[SKIPPED]: viff.test.test_basic_runtime.ProgramCounterTest.
+test_multiple_callbacks
+
+TODO: Scheduling callbacks fails to increment program counter!
+---------------------------------------------------------------------
+Ran 65 tests in 18.305s
+
+PASSED (skips=1, successes=64)</pre>
+<p>Lots of success! But one of the tests was skipped — we do this when we
+have a test which represents a known problem. Otherwise every test run
+would be cluttered with long of traceback messages, making it
+difficult to notice new <em>unexpected</em> failures.</p>
+</div>
+<div class="section">
+<h2 id="writing-unit-tests">Writing Unit Tests<a class="headerlink" href="#writing-unit-tests" title="Permalink to this headline">¶</a></h2>
+<p>The unit tests live in the <tt class="docutils literal"><span class="pre">viff.test</span></tt> package. There you will find
+a number of modules, which in turn contain classes inheriting from
+<tt class="docutils literal"><span class="pre">twisted.trial.unittest.TestCase</span></tt>. Trial recognizes these classes
+and will execute methods starting with <tt class="docutils literal"><span class="pre">test</span></tt>.</p>
+<div class="section">
+<h3 id="simple-tests">Simple Tests<a class="headerlink" href="#simple-tests" title="Permalink to this headline">¶</a></h3>
+<p>Adding a new unit test can be as simple as defining a new method in a
+suitable class. The method will want to assert certain things during
+the test, and for that Trial offers a large number of convenient
+methods such as <tt class="docutils literal"><span class="pre">assertEqual</span></tt>, <tt class="docutils literal"><span class="pre">assertTrue</span></tt>, and so on. The full
+reference is available <a class="reference" href="http://twistedmatrix.com/documents/current/api/twisted.trial.unittest._Assertions.html">online</a>. Notice that they describe the
+methods under names like <tt class="docutils literal"><span class="pre">failUnlessSomething</span></tt> which is aliased to
+<tt class="docutils literal"><span class="pre">assertSomething</span></tt>. So far all the VIFF unit tests use the
+<tt class="docutils literal"><span class="pre">assertSomething</span></tt> style, but you are welcome to use the other if you
+prefer.</p>
+<p>A simple example of a unit test is <tt class="docutils literal"><span class="pre">viff.test.test_field</span></tt> which
+looks like this (heavily abbreviated):</p>
+<div class="highlight"><pre><span class="sd">&quot;&quot;&quot;Tests for viff.field.&quot;&quot;&quot;</span>
+
+<span class="k">from</span> <span class="nn">viff.field</span> <span class="k">import</span> <span class="n">GF</span><span class="p">,</span> <span class="n">GF256</span>
+<span class="k">from</span> <span class="nn">twisted.trial.unittest</span> <span class="k">import</span> <span class="n">TestCase</span>
+
+<span class="c">#: Declare doctests for Trial.</span>
+<span class="n">__doctests__</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;viff.field&#39;</span><span class="p">]</span>
+
+<span class="k">class</span> <span class="nc">GFpElementTestCase</span><span class="p">(</span><span class="n">TestCase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;Tests for elements from a Zp field.&quot;&quot;&quot;</span>
+
+    <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;Initialize Zp to Z31.&quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">field</span> <span class="o">=</span> <span class="n">GF</span><span class="p">(</span><span class="mf">31</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">test_invert</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;Test inverse operation, including inverting zero.&quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="k">lambda</span><span class="p">:</span> <span class="o">~</span><span class="bp">self</span><span class="o">.</span><span class="n">field</span><span class="p">(</span><span class="mf">0</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">assertEquals</span><span class="p">(</span><span class="o">~</span><span class="bp">self</span><span class="o">.</span><span class="n">field</span><span class="p">(</span><span class="mf">1</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">field</span><span class="p">(</span><span class="mf">1</span><span class="p">))</span>
+
+    <span class="k">def</span> <span class="nf">test_sqrt</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;Test extraction of square roots.&quot;&quot;&quot;</span>
+        <span class="n">square</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">field</span><span class="p">(</span><span class="mf">4</span><span class="p">)</span><span class="o">**</span><span class="mf">2</span>
+        <span class="n">root</span> <span class="o">=</span> <span class="n">square</span><span class="o">.</span><span class="n">sqrt</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">assertEquals</span><span class="p">(</span><span class="n">root</span><span class="o">**</span><span class="mf">2</span><span class="p">,</span> <span class="n">square</span><span class="p">)</span>
+</pre></div>
+<p>This demonstrates the most important features in a simple unit test:</p>
+<ul class="simple">
+<li>First the needed definitions are imported as normal.</li>
+<li>Setting the <tt class="docutils literal"><span class="pre">__doctest__</span></tt> field makes Trial run the <a class="reference" href="http://docs.python.org/lib/module-doctest.html">doctests</a> in
+the named module.</li>
+<li>A class is defined which inherit from <tt class="docutils literal"><span class="pre">TestCase</span></tt>.</li>
+<li>A <tt class="docutils literal"><span class="pre">setUp</span></tt> method is used to collect preperations that are needed
+for every test.</li>
+<li>Several test methods are defined. They make use of the assertions
+offered by Trial.</li>
+</ul>
+</div>
+<div class="section">
+<h3 id="tests-involving-a-viff-runtime">Tests Involving a VIFF Runtime<a class="headerlink" href="#tests-involving-a-viff-runtime" title="Permalink to this headline">¶</a></h3>
+<p>Trial really shines when it comes to testing that involves networking.
+First, it allows us to forget about the networking — the network
+connections are replaced by direct method calls on the receiver&#8217;s
+transport. This makes the test repeatable unlike if real network
+connections were used since they may fail if they cannot bind to the
+wanted port number.</p>
+<p>In VIFF the <tt class="docutils literal"><span class="pre">util.py</span></tt> file contains the logic needed to connect a
+number of Runtime instances in this way. All you need to do is to
+create a subclass of RuntimeTestCase and decorate the test methods
+with <tt class="docutils literal"><span class="pre">protocol</span></tt> like this example (abbreviated from
+<tt class="docutils literal"><span class="pre">viff.test.test_active_runtime</span></tt>):</p>
+<div class="highlight"><pre><span class="k">from</span> <span class="nn">viff.test.util</span> <span class="k">import</span> <span class="n">RuntimeTestCase</span><span class="p">,</span> <span class="n">protocol</span>
+
+<span class="k">class</span> <span class="nc">ActiveRuntimeTest</span><span class="p">(</span><span class="n">RuntimeTestCase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;Test for active security.&quot;&quot;&quot;</span>
+
+    <span class="c">#: Number of players.</span>
+    <span class="n">num_players</span> <span class="o">=</span> <span class="mf">4</span>
+
+    <span class="nd">@protocol</span>
+    <span class="k">def</span> <span class="nf">test_broadcast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">runtime</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;Test Bracha broadcast.&quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">runtime</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="mf">1</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">broadcast</span><span class="p">([</span><span class="mf">1</span><span class="p">],</span> <span class="s">&quot;Hello world!&quot;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="n">runtime</span><span class="o">.</span><span class="n">broadcast</span><span class="p">([</span><span class="mf">1</span><span class="p">])</span>
+        <span class="n">x</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">assertEquals</span><span class="p">,</span> <span class="s">&quot;Hello world!&quot;</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">x</span>
+</pre></div>
+<p>By decorating <tt class="docutils literal"><span class="pre">test_broadcast</span></tt> with <tt class="docutils literal"><span class="pre">protocol</span></tt> we ensure that the
+method will be called with a Runtime instance. Furthermore, the method
+will be called <tt class="docutils literal"><span class="pre">num_player</span></tt> times, each time with another Runtime
+instance. The net result is that the test behaves just like if four
+players had started four programs containing the method body.</p>
+<p>In the method you can branch on <tt class="docutils literal"><span class="pre">runtime.id</span></tt>. This is needed in the
+typical case where you want only one of the parties to input something
+to a calculation.</p>
+<p>In this example all four parties get an <tt class="docutils literal"><span class="pre">x</span></tt> which will eventually
+contain the string &#8220;Hello World&#8221;. Using Trial we can return <tt class="docutils literal"><span class="pre">x</span></tt> and
+Trial will then wait for <tt class="docutils literal"><span class="pre">x</span></tt> to trigger before declaring the test a
+success or failure. We have attached <tt class="docutils literal"><span class="pre">self.assertEquals</span></tt> as a
+callback on <tt class="docutils literal"><span class="pre">x</span></tt> with an extra argument of &#8220;Hello World&#8221;. This means
+that when <tt class="docutils literal"><span class="pre">x</span></tt> eventually triggers, the assertion is run and the test
+finishes.</p>
+<p>This is the real power of Trial. You can do some calculations and
+finish by returning a Deferred (and remember that Shares are Deferreds
+in VIFF). The value of this Deferred is not important, it is only
+important that it triggers when the test is done. You will often need
+to use <tt class="docutils literal"><span class="pre">twisted.internet.defer.gatherResults</span></tt> to combine several
+Deferreds into one that you can return to Trial. Just make sure that
+your final Deferred depends on all other Deferreds so that you do not
+leave lingering Deferreds behind. Trial will complain loudly if you
+do, so it should be easy to spot.</p>
+</div>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h3>Table Of Contents</h3>
+            <ul>
+<li><a class="reference" href="">Unit Testing</a><ul>
+<li><a class="reference" href="#running-the-unit-tests">Running the Unit Tests</a></li>
+<li><a class="reference" href="#writing-unit-tests">Writing Unit Tests</a><ul>
+<li><a class="reference" href="#simple-tests">Simple Tests</a></li>
+<li><a class="reference" href="#tests-involving-a-viff-runtime">Tests Involving a VIFF Runtime</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="development.html" title="previous chapter">Developer&#8217;s Guide</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="implementation.html" title="next chapter">Implementation</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/unit-testing.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="N">next</a> |</li>
+          <li class="right"><a href="development.html" title="Developer&#8217;s Guide" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/0.6/util.html	Wed May 28 19:30:53 2008 +0200
@@ -0,0 +1,224 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Utility Functions Module &mdash; VIFF v0.6 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:   '',
+        VERSION:    '0.6'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/interface.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="contents" title="Global table of contents" href="contents.html" />
+    <link rel="index" title="Global index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="top" title="VIFF v0.6 documentation" href="index.html" />
+    <link rel="up" title="Implementation" href="implementation.html" />
+    <link rel="next" title="Finite Fields Module" href="field.html" />
+    <link rel="prev" title="Implementation" href="implementation.html" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="field.html" title="Finite Fields Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  
+  <div class="section">
+<h1 id="module-viff.util">Utility Functions Module<a class="headerlink" href="#module-viff.util" title="Permalink to this headline">¶</a></h1>
+<p>Miscellaneous utility functions. This module contains various
+utility functions used in all parts of the VIFF code. The most
+important is the <a title="viff.util.rand" class="reference" href="#viff.util.rand"><tt class="xref docutils literal"><span class="pre">rand</span></tt></a> random generator which is seeded with a
+known seed each time. Using this generator for all random numbers
+ensures that a protocol run can be reproduced at a later time.</p>
+<dl class="envvar">
+<dt id="envvar-SEED">
+<tt class="descname">SEED</tt><a class="headerlink" href="#envvar-SEED" title="Permalink to this definition">¶</a></dt>
+<dd>The <a title="viff.util.rand" class="reference" href="#viff.util.rand"><tt class="xref docutils literal"><span class="pre">rand</span></tt></a> random generator is seeded using this
+environment variable, if it is defined.</dd></dl>
+
+<dl class="data">
+<dt id="viff.util.rand">
+<!--#viff.util.rand#--><tt class="descclassname">viff.util.</tt><tt class="descname">rand</tt><a class="headerlink" href="#viff.util.rand" title="Permalink to this definition">¶</a></dt>
+<dd><p>All VIFF code uses this random number generator for all
+randomness needed.</p>
+<p>The generator is by default initialized with a random seed,
+unless the environment variable <span class="target" id="index-0"></span><a class="reference" href="#envvar-SEED"><strong>SEED</strong></a> is set to a
+value, in which case that value is used instead. If
+<span class="target" id="index-1"></span><a class="reference" href="#envvar-SEED"><strong>SEED</strong></a> is defined, but empty, then no seed is used and a
+protocol run cannot be reproduced exactly.</p>
+</dd></dl>
+
+<dl class="envvar">
+<dt id="envvar-VIFF_NO_WRAP">
+<tt class="descname">VIFF_NO_WRAP</tt><a class="headerlink" href="#envvar-VIFF_NO_WRAP" title="Permalink to this definition">¶</a></dt>
+<dd>Setting this environment variable to any value will turn
+<a title="viff.util.wrapper" class="reference" href="#viff.util.wrapper"><tt class="xref docutils literal"><span class="pre">wrapper()</span></tt></a> into a no-op.</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.clone_deferred">
+<!--#viff.util.clone_deferred#--><tt class="descclassname">viff.util.</tt><tt class="descname">clone_deferred</tt><big>(</big><em>original</em><big>)</big><a class="headerlink" href="#viff.util.clone_deferred" title="Permalink to this definition">¶</a></dt>
+<dd><p>Clone a Deferred.</p>
+<p>The returned clone will fire with the same result as the original
+<tt class="xref docutils literal"><span class="pre">Deferred</span></tt>, but will otherwise be independent.</p>
+<p>It is an error to call <tt class="xref docutils literal"><span class="pre">callback()</span></tt> on the clone as it will
+result in an <tt class="xref docutils literal"><span class="pre">AlreadyCalledError</span></tt> when the original
+<tt class="xref docutils literal"><span class="pre">Deferred</span></tt> is triggered.</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Deferred</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="k">lambda</span> <span class="n">result</span><span class="p">:</span> <span class="n">result</span> <span class="o">*</span> <span class="mf">10</span><span class="p">)</span> <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;Deferred at 0x...&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">clone_deferred</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="k">lambda</span> <span class="n">result</span><span class="p">:</span> <span class="n">result</span> <span class="o">+</span> <span class="mf">1</span><span class="p">)</span>  <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;Deferred at 0x...&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="k">lambda</span> <span class="n">result</span><span class="p">:</span> <span class="n">result</span> <span class="o">+</span> <span class="mf">2</span><span class="p">)</span>  <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;Deferred at 0x...&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">callback</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span>                                         <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;Deferred at 0x...  current result: 12&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span>                                         <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;Deferred at 0x...  current result: 11&gt;</span>
+</pre></div>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.deprecation">
+<!--#viff.util.deprecation#--><tt class="descclassname">viff.util.</tt><tt class="descname">deprecation</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#viff.util.deprecation" title="Permalink to this definition">¶</a></dt>
+<dd>Issue a deprecation warning.</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.dlift">
+<!--#viff.util.dlift#--><tt class="descclassname">viff.util.</tt><tt class="descname">dlift</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#viff.util.dlift" title="Permalink to this definition">¶</a></dt>
+<dd><p>Lift a function to handle deferred arguments.</p>
+<p>Use this as a decorator. The decorated function accepts the same
+arguments as the original function, but arguments for the lifted
+function can be Deferreds. The return value of the lifted function
+will always be a Deferred.</p>
+<p>Keyword arguments are not lifted.</p>
+<p>As an example, here is how to define a lazy addition and
+multiplication which works for integers (deferred or not):</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nd">@dlift</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
+<span class="gp">... </span>    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nd">@dlift</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">mul</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
+<span class="gp">... </span>    <span class="k">return</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Deferred</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">Deferred</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span> <span class="o">=</span> <span class="n">mul</span><span class="p">(</span><span class="n">add</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mf">10</span><span class="p">),</span> <span class="n">y</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">callback</span><span class="p">(</span><span class="mf">5</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span><span class="o">.</span><span class="n">callback</span><span class="p">(</span><span class="mf">10</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span>                                         <span class="c"># doctest: +ELLIPSIS</span>
+<span class="go">&lt;DeferredList at 0x...  current result: 150&gt;</span>
+</pre></div>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.dprint">
+<!--#viff.util.dprint#--><tt class="descclassname">viff.util.</tt><tt class="descname">dprint</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#viff.util.dprint" title="Permalink to this definition">¶</a></dt>
+<dd>Lifted wrapper function.</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.find_prime">
+<!--#viff.util.find_prime#--><tt class="descclassname">viff.util.</tt><tt class="descname">find_prime</tt><big>(</big><em>lower_bound</em>, <em>blum=False</em><big>)</big><a class="headerlink" href="#viff.util.find_prime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Find a prime above a lower bound.</p>
+<p>If a prime is given as the lower bound, then this prime is
+returned:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">find_prime</span><span class="p">(</span><span class="mf">37</span><span class="p">)</span>
+<span class="go">37L</span>
+</pre></div>
+<p>The bound can be a Python expression as a string. This makes it
+easy for users to specify command line arguments that generates
+primes of a particular bit length:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">find_prime</span><span class="p">(</span><span class="s">&quot;2**100&quot;</span><span class="p">)</span> <span class="c"># 100 bit prime</span>
+<span class="go">1267650600228229401496703205653L</span>
+</pre></div>
+<p>Blum primes (a prime p such that p % 4 == 3) can be found as well:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">find_prime</span><span class="p">(</span><span class="mf">12</span><span class="p">)</span>
+<span class="go">13L</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">find_prime</span><span class="p">(</span><span class="mf">12</span><span class="p">,</span> <span class="n">blum</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="go">19L</span>
+</pre></div>
+<p>If the bound is negative, 2 (the smallest prime) is returned:</p>
+<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">find_prime</span><span class="p">(</span><span class="o">-</span><span class="mf">100</span><span class="p">)</span>
+<span class="go">2L</span>
+</pre></div>
+</dd></dl>
+
+<dl class="function">
+<dt id="viff.util.wrapper">
+<!--#viff.util.wrapper#--><tt class="descclassname">viff.util.</tt><tt class="descname">wrapper</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#viff.util.wrapper" title="Permalink to this definition">¶</a></dt>
+<dd><p>Decorator used for wrapper functions.</p>
+<p>It is important to use this decorator on any wrapper functions in
+order to ensure that they end up with correct <tt class="xref docutils literal"><span class="pre">__name__</span></tt> and
+<tt class="xref docutils literal"><span class="pre">__doc__</span></tt> attributes.</p>
+<p>In addition, if the environment variable <span class="target" id="index-2"></span><a class="reference" href="#envvar-VIFF_NO_WRAP"><strong>VIFF_NO_WRAP</strong></a> is
+defined, then the wrapper functions will be turned into functions
+that <em>do not</em> wrap &#8211; instead they let their argument function
+through unchanged. This is done so that epydoc and Sphinx can see
+the true function arguments when generating documentation. Just
+remember that your code will break if <span class="target" id="index-3"></span><a class="reference" href="#envvar-VIFF_NO_WRAP"><strong>VIFF_NO_WRAP</strong></a> is
+set, so it should only be used when documentation is being
+generated.</p>
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="implementation.html" title="previous chapter">Implementation</a></p>
+            <h4>Next topic</h4>
+            <p class="topless"><a href="field.html" title="next chapter">Finite Fields Module</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/util.txt">Show Source</a></li>
+            </ul>
+            <h3>Quick search</h3>
+            <form class="search" action="search.html" method="get">
+              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
+        <li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
+          <li class="right"><a href="field.html" title="Finite Fields Module" accesskey="N">next</a> |</li>
+          <li class="right"><a href="implementation.html" title="Implementation" accesskey="P">previous</a> |</li>
+        <li><a href="index.html">VIFF v0.6 documentation</a> &raquo;</li>
+          <li><a href="implementation.html" accesskey="U">Implementation</a> &raquo;</li>
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2008, VIFF Development Team.
+      Last updated on May 28, 2008.
+    </div>
+  </body>
+</html>
\ No newline at end of file