def _blind_raw_id_batch(raw_id_batch, e, n):
     hashed_ids = PsiRsaSigner._crypto_hash_list(
             raw_id_batch.raw_ids, True
         )
     blind_numbers = [random.SystemRandom().getrandbits(256)
                      for i in range(len(raw_id_batch))]
     byte_len = n.bit_length() // 8
     blinded_hashed_ids = [int2bytes((powmod(r, e, n) * x % n).digits(),
                                     byte_len)
                           for x, r in zip(hashed_ids, blind_numbers)]
     return (blinded_hashed_ids, blind_numbers)
Beispiel #2
0
 def _psi_sign_impl(items, d, n):
     byte_len = n.bit_length() // 8
     return [
         int2bytes(powmod(bytes2int(item), d, n).digits(), byte_len)
         for item in items
     ]