maths/circuits
This module contains code to do arithmetic circuit logic on integers.
All values are assumed to be in [0, p-1] and p is a prime.
Results are always reduced into [0, p-1]. Aiken’s % is a floored
modulo (the result takes the sign of the divisor), so negative
intermediate values wrap around correctly for any positive p.
Functions
Performs a logical AND operation on two integer values within an arithmetic circuit.
circuits.and_(1, 1, p)
Performs a logical OR operation on two integer values within an arithmetic circuit.
circuits.or_(0, 1, p)
Performs a logical NOT operation on an integer value within an arithmetic circuit.
circuits.not_(1, p)
Performs a logical XOR operation on two integer values within an arithmetic circuit.
circuits.xor_(0, 1, p)
Performs a logical NAND operation on two integer values within an arithmetic circuit.
circuits.nand_(1, 1, p)
Performs a logical NOR operation on two integer values within an arithmetic circuit.
circuits.nor_(0, 0, p)
Performs a logical XNOR operation on two integer values within an arithmetic circuit.
circuits.xnor_(1, 1, p)