Example #1
0
def EQZ(a, k, kappa):
    prog = program.Program.prog
    if prog.use_split():
        from GC.types import sbitvec
        v = sbitvec(a, k).v
        bit = util.tree_reduce(operator.and_, (~b for b in v))
        return types.sint.conv(bit)
    prog.non_linear.check_security(kappa)
    return prog.non_linear.eqz(a, k)
def EQZ(a, k, kappa):
    prog = program.Program.prog
    if prog.use_split():
        from GC.types import sbitvec
        v = sbitvec(a, k).v
        bit = util.tree_reduce(operator.and_, (~b for b in v))
        return types.sint.conv(bit)
    if program.Program.prog.options.ring:
        c, r = maskRing(a, k)
    else:
        c, r = maskField(a, k, kappa)
    d = [None] * k
    for i, b in enumerate(r[0].bit_decompose_clear(c, k)):
        d[i] = r[i].bit_xor(b)
    return 1 - types.sint.conv(KOR(d, kappa))