Guest User

Untitled

a guest
Oct 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def combine(shares: Set[Decryption], key, params) -> int:
  2. n = key.n
  3. n_squared = n * n
  4.  
  5. threshold, Δ = params.threshold, params.Δ
  6. c = 1
  7.  
  8. shares = shares[:threshold]
  9. for i in shares:
  10. µ = Δ
  11.  
  12. for j in shares:
  13. print(i.id, j.id)
  14. if i is j:
  15. continue
  16.  
  17. µ *= -j.id // (j.id - i.id)
  18. c *= pow(i.value, 2 * µ, n_squared)
  19.  
  20. L = 4 * Δ * Δ
  21. c //= L * key.θ
  22. return ((c - 1) // n * modular_inverse(L, n)) % n
Add Comment
Please, Sign In to add comment