Exemplo n.º 1
0
def _pfield(l, f, p, n):
    k = runtime.options.sec_param
    if p is None:
        p = finfields.find_prime_root(l + max(f, k + 1) + 1, n=n)
    else:
        assert p.bit_length() > l + max(f, k + 1), f'Prime {p} too small.'
    return finfields.GF(p, f)
Exemplo n.º 2
0
def _pfield(l, f, p, n):
    k = runtime.options.sec_param
    if p is None:
        p = finfields.find_prime_root(l + f + k + 2, n=n)
    elif p.bit_length() <= l + f + k + 1:
        raise ValueError(f'Prime {p} too small.')

    return finfields.GF(p, f)
Exemplo n.º 3
0
def _pfield(l, f, p, n):
    k = runtime.options.sec_param
    if p is None:
        p = finfields.find_prime_root(l + f + k + 2, n=n)
    elif p.bit_length() <= l + f + k + 1:
        raise ValueError(f'Prime {p} too small.')

    field = finfields.GF(p)
    assert runtime.threshold == 0 or len(
        runtime.parties) < field.order  # for Shamir secret sharing
    return field