<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><blockquote type="cite"><div>Some good old-fashioned code review coming up... :-)<br></div></blockquote><div>Great!</div><br><blockquote type="cite"><div><blockquote type="cite">/rev/736ad1d97024<br></blockquote><blockquote type="cite">changeset: 1361:736ad1d97024<br></blockquote><blockquote type="cite">user: Janus Dam Nielsen <<a href="mailto:janus.nielsen@alexandra.dk">janus.nielsen@alexandra.dk</a>><br></blockquote><blockquote type="cite">date: Wed Oct 28 14:53:51 2009 +0100<br></blockquote><blockquote type="cite">summary: Generate_config_files:Added support NaCl implementation of Paillier.<br></blockquote><br>There's a space missing after the colon.<br></div></blockquote><div>Ok.</div><br><blockquote type="cite"><div><blockquote type="cite">diffstat:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> apps/generate-config-files.py | 22 +++++++++++++++++++---<br></blockquote><blockquote type="cite"> viff/paillierutil.py | 20 +++++++++++++++++++-<br></blockquote><blockquote type="cite"> 2 files changed, 38 insertions(+), 4 deletions(-)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">diffs (90 lines):<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">diff -r 3fe6e03541c1 -r 736ad1d97024 apps/generate-config-files.py<br></blockquote><blockquote type="cite">--- a/apps/generate-config-files.py<span class="Apple-tab-span" style="white-space:pre">        </span>Wed Oct 28 14:53:49 2009 +0100<br></blockquote><blockquote type="cite">+++ b/apps/generate-config-files.py<span class="Apple-tab-span" style="white-space:pre">        </span>Wed Oct 28 14:53:51 2009 +0100<br></blockquote><blockquote type="cite">@@ -55,7 +55,17 @@<br></blockquote><blockquote type="cite"> from optparse import OptionParser<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> from viff.config import generate_configs<br></blockquote><blockquote type="cite">-from viff.paillierutil import ViffPaillier<br></blockquote><blockquote type="cite">+from viff.paillierutil import ViffPaillier, NaClPaillier<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+try:<br></blockquote><blockquote type="cite">+ import pypaillier<br></blockquote><blockquote type="cite">+except ImportError:<br></blockquote><blockquote type="cite">+ pypaillier = None<br></blockquote><br>Are we getting a module called 'pypaillier' alongside the old module<br>called 'paillier'? I don't like that name very much. Perhaps we should<br>make a module called nacl so that you could do<br><br> try:<br> from viff.nacl import paillier<br> except ImportError:<br> from viff import paillier<br><br>and then make the interface identical for the two modules.<br></div></blockquote><div>Agree, this is a goal to be pursued soonish, but I would like Marc to make a distribution of his work that can be accessed somewhere on the internet. </div><div>I believe the interfaces are identical</div><br><blockquote type="cite"><div>Also, can we please have that code put into VIFF? I don't like it that<br>we're getting more and more "secret" code floating around :-) Especially<br>not when we make changes to VIFF to accomodate this secret code -- it<br>would be different if we had simple drop-in Python replacements for it.<br><br>(I know you've said that this code can be made public since it's part of<br>NaCL, so this is more for the record...)<br></div></blockquote><div>The code will not be a part of VIFF, but a prerequisite like Zope interfaces or Twisted. I will issue warning on the mailling list when I submit the changeset that will require it. </div><br><blockquote type="cite"><div><blockquote type="cite">+<br></blockquote><blockquote type="cite">+paillier_choices = ['viff']<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if pypaillier:<br></blockquote><blockquote type="cite">+ paillier_choices += ['nacl']<br></blockquote><br>The append method is better for that.<br></div></blockquote>Ok.</div><div><br><blockquote type="cite"><div><br><blockquote type="cite">+paillier = ViffPaillier(options.keysize)<br></blockquote><blockquote type="cite">+if "nacl" == options.paillier:<br></blockquote><blockquote type="cite">+ paillier = NaClPaillier(options.keysize)<br></blockquote><br>I think it's clearer if you write<br><br> if options.paillier == "nacl":<br> paillier = NaClPaillier(options.keysize)<br> else:<br> paillier = ViffPaillier(options.keysize)<br></div></blockquote><div>I slightly disagree. </div><div> if "nacl" == options.paillier:</div><div> paillier = NaClPaillier(options.keysize)</div><div> else:</div><div> paillier = ViffPaillier(options.keysize)</div><div><div>Is more natural in the current case.</div><div><br></div></div><br><blockquote type="cite"><div><blockquote type="cite">+try:<br></blockquote><blockquote type="cite">+ import pypaillier<br></blockquote><blockquote type="cite">+except ImportError:<br></blockquote><blockquote type="cite">+ pypaillier = None<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> class Paillier:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> def __init__(self, keysize):<br></blockquote><blockquote type="cite">@@ -35,8 +41,20 @@<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> def generate_keys(self):<br></blockquote><blockquote type="cite"> return paillier.generate_keys(self.keysize)<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+class NaClPaillier:<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ def __init__(self, keysize):<br></blockquote><blockquote type="cite">+ self.keysize = keysize<br></blockquote><blockquote type="cite">+ self.type = 'nacl'<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ def generate_keys(self):<br></blockquote><blockquote type="cite">+ return pypaillier.generate_keys(self.keysize)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> def deserializer(paillier_type, str):<br></blockquote><blockquote type="cite">- return tuple(map(long, str))<br></blockquote><blockquote type="cite">+ if paillier_type == "viff":<br></blockquote><blockquote type="cite">+ return tuple(map(long, str))<br></blockquote><blockquote type="cite">+ if paillier_type == "nacl":<br></blockquote><blockquote type="cite">+ return str.dict()<br></blockquote><br>I think that function would belong in the otherwise unnecessary classes<br>you define above?</div></blockquote><blockquote type="cite"><div>Or even better: make a function in two different<br>modules like I suggest above.<br></div></blockquote>This is a good question. I choose the current design because it leaves you with only one place you should change if you want to add another paillier implementation. I need to think some more before I comment further on this. </div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial" size="2"><b><font class="Apple-style-span" color="#f05a23">____________________________________________________</font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23"><br></font></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">Janus Dam Nielsen</font></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; min-height: 8px; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><br></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Arial; font-size: 10px; font-weight: bold; "><font class="Apple-style-span" color="#5a5a5a">Research and Innovationspecialist, PhD.</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Helvetica; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">CENTRE FOR IT-SECURITY</font></font></font></div></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Helvetica; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">THE ALEXANDRA INSTITUTE LTD.</font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"> </font></font></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; min-height: 8px; "><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Helvetica; "><div><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span style="letter-spacing: 0.1px; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">T</font></font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"> </font></font></font></span><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">+45 42 22 93 56</font></font></font></span></div><div><font class="Apple-style-span" color="#5A5A5A" face="Arial" size="2"><span class="Apple-style-span" style="font-size: 10px; ">E<span class="Apple-converted-space"> </span><span class="Apple-style-span" style="color: rgb(240, 90, 35); "><a href="mailto:janus.nielsen@alexandra.dk">janus.nielsen@alexandra.dk</a></span></span></font></div><div><span class="Apple-style-span" style="color: rgb(213, 61, 33); font-family: Arial; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">W</font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" size="2"> </font></span><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">alexandra.dk</font></font></span></div></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Arial; font-weight: bold; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">____________________________________________________</font></font></span></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span> </div><br></body></html>