viff

changeset 1558:91f2daeb15a5

BeDOZa: Zero-knowledge proof now returns True or False.
author Thomas P Jakobsen <tpj@cs.au.dk>
date Tue, 28 Sep 2010 14:45:31 +0200
parents cc989536bad7
children 18b3699be9db
files viff/bedoza/zero_knowledge.py viff/test/bedoza/test_zero_knowledge.py
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/viff/bedoza/zero_knowledge.py	Tue Sep 28 14:33:35 2010 +0200
     1.2 +++ b/viff/bedoza/zero_knowledge.py	Tue Sep 28 14:45:31 2010 +0200
     1.3 @@ -101,9 +101,15 @@
     1.4              #print self.runtime.id, j, S[j] % n**2
     1.5              #print self.runtime.id, j, T[j]
     1.6              # TODO: Return false if S[j] != T[j].
     1.7 +            if S[j] != T[j]:
     1.8 +                # TODO: Proof failed, return false!
     1.9 +                pass
    1.10              if abs(self.Z[j]) > 2**(2 * self.k):
    1.11 -                print "WOOOOOOOOOOPS, PROOF NOT ACCEPTED"
    1.12 +                # TODO: Proof failed, return false!
    1.13 +                pass
    1.14  
    1.15 +        return True
    1.16 +        
    1.17  
    1.18      def _generate_u_v_and_d(self):
    1.19          self.u, self.v, self.d = [], [], []
     2.1 --- a/viff/test/bedoza/test_zero_knowledge.py	Tue Sep 28 14:33:35 2010 +0200
     2.2 +++ b/viff/test/bedoza/test_zero_knowledge.py	Tue Sep 28 14:45:31 2010 +0200
     2.3 @@ -172,6 +172,9 @@
     2.4              zk = ZKProof(s, prover_id, k, runtime, c, paillier=paillier, random=player_random)
     2.5  
     2.6          deferred_proof = zk.start()
     2.7 +        def verify(result):
     2.8 +            self.assertTrue(result)
     2.9 +        runtime.schedule_callback(deferred_proof, verify)
    2.10          return deferred_proof
    2.11  
    2.12  # TODO: Test succeeding proof.