コード例 #1
0
 def voter_id_hash(self):
     if self.voter_login_id:
         # for backwards compatibility with v3.0, and since it doesn't matter
         # too much if we hash the email or the unique login ID here.
         return utils.hash_b64(self.voter_login_id)
     else:
         return utils.hash_b64(self.voter_id)
コード例 #2
0
ファイル: electionalgs.py プロジェクト: glondu/helios-server
 def voter_id_hash(self):
   if self.voter_login_id:
     # for backwards compatibility with v3.0, and since it doesn't matter
     # too much if we hash the email or the unique login ID here.
     return utils.hash_b64(self.voter_login_id)
   else:
     return utils.hash_b64(self.voter_id)
コード例 #3
0
 def get_voters_hash(self):
     voters = self.get_voters()
     voters_json = dumps([
         v.toJSONDict(with_vote=False, with_vote_hash=False) for v in voters
     ])
     # logging.info("json for voters is: " + voters_json)
     return utils.hash_b64(voters_json)
コード例 #4
0
ファイル: thresholdalgs.py プロジェクト: Pmaene/Helios
 def generate(self, m, secret_key, p, q, g):
     while True:
         hash = utils.hash_b64(m)
         hash_dec = utils.encode_string_to_decimal(hash)
         k = algs.Utils.random_k_relative_prime_p_1(p)
         k_inv = algs.Utils.inverse(k, p - 1)
         x = secret_key.x
         r = pow(g, k, p)
         s = ((hash_dec - x * r) * k_inv) % (p - 1)
         if s != 1:
             self.s = s
             self.r = r
             return None
コード例 #5
0
ファイル: thresholdalgs.py プロジェクト: Pmaene/Helios
    def verify(self, m, public_key, p, q, g):
        correct = True
        y = public_key.y
        hash = utils.hash_b64(m)
        hash_dec = utils.encode_string_to_decimal(hash)
        if self.r >= p:
            correct = False
        if self.s >= p - 1:
            correct = False
        val = (pow(y, self.r, p) * pow(self.r, self.s, p)) % p
        if (pow(g, hash_dec, p) != val):
            correct = False

        return correct
コード例 #6
0
 def hash(self):
     s = utils.to_json(self.toJSONDict())
     return utils.hash_b64(s)
コード例 #7
0
 def get_hash(self):
     return utils.hash_b64(utils.to_json(self.toJSONDict()))
コード例 #8
0
ファイル: electionalgs.py プロジェクト: glondu/helios-server
 def hash(self):
   s = utils.to_json(self.toJSONDict())
   return utils.hash_b64(s)
コード例 #9
0
 def voter_id_hash(self):
     return utils.hash_b64(self.uid)
コード例 #10
0
ファイル: electionalgs.py プロジェクト: Pmaene/Helios
 def get_hash(self):
     return utils.hash_b64(utils.to_json(self.toJSONDict()))
コード例 #11
0
 def get_hash(self):
     return utils.hash_b64(
         utils.to_json(self.toJSONDict(), no_whitespace=True))
コード例 #12
0
 def compute_vote_hash(self):
     vote_hash = utils.hash_b64(utils.to_json(self.vote))
     return vote_hash
コード例 #13
0
 def voter_id_hash(self):
   return utils.hash_b64(self.voter_id)
コード例 #14
0
ファイル: models.py プロジェクト: benadida/helios
 def compute_vote_hash(self):
   vote_hash = utils.hash_b64(utils.to_json(self.vote))
   return vote_hash
コード例 #15
0
ファイル: models.py プロジェクト: benadida/helios
 def get_voters_hash(self):
   voters = self.get_voters()
   voters_json = dumps([v.toJSONDict(with_vote=False, with_vote_hash=False) for v in voters])
   # logging.info("json for voters is: " + voters_json)
   return utils.hash_b64(voters_json)