Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def combine(shares: Set[Decryption], key, params) -> int:
- n = key.n
- n_squared = n * n
- threshold, Δ = params.threshold, params.Δ
- c = 1
- shares = shares[:threshold]
- for i in shares:
- µ = Δ
- for j in shares:
- print(i.id, j.id)
- if i is j:
- continue
- µ *= -j.id // (j.id - i.id)
- c *= pow(i.value, 2 * µ, n_squared)
- L = 4 * Δ * Δ
- c //= L * key.θ
- return ((c - 1) // n * modular_inverse(L, n)) % n
Add Comment
Please, Sign In to add comment