def getCCEInput(self): constraint = self.argsdict['max_exp_message_c'] m = randint(0,2**constraint-1) r = self.publicKey.random() cce, cproof = self.publicKey.encryptwithCproof(m,r) com = self.publicKey.derivCom(cce) rproof = nizk.base2RangeProof(self.publicKey,com,m,r,constraint) self.addInputsSend((cce,com,cproof,rproof)) return cce,cproof,rproof
def getCCEInput(self, maxexp=16): self.maxexp = maxexp constraint = 2**self.maxexp m = randint(0, constraint) r = self.publicKey.random() cce, cproof = self.publicKey.encryptwithCproof(m, r) com = self.publicKey.derivCom(cce) mproof = nizk.base2RangeProof(self.publicKey, com, m, r, maxexp, False) self.addInputsSend((cce, com, cproof, mproof)) return cce, cproof, mproof
def getCCEInput(self,maxexp=16): self.maxexp = maxexp constraint = 2**self.maxexp m = randint(0,constraint) r = self.publicKey.random() cce, cproof = self.publicKey.encryptwithCproof(m,r) com = self.publicKey.derivCom(cce) mproof = nizk.base2RangeProof(self.publicKey,com,m,r,maxexp,False) self.addInputsSend((cce,com,cproof,mproof)) return cce,cproof,mproof
def test_range_proof_on_commitment(self): m = randint(1,self.maxmessage) r = randint(1,self.n-1) com,r = self.ppatspk.commit(m,r) proof = nizk.base2RangeProof(self.ppatspk,com,m,r,self.maxexp,verif = True) self.assertTrue(nizk.base2RangeProofCheck(self.ppatspk,com,proof))