コード例 #1
0
ファイル: SecureWord.cs プロジェクト: jnagykuhlen/CompactMPC
        public static SecureBoolean operator ==(SecureWord left, SecureWord right)
        {
            if (left.Builder != right.Builder)
            {
                throw new ArgumentException("Secure words must use the same circuit builder for constructing gates.");
            }

            CircuitBuilder builder = right.Builder;

            if (left.Length != right.Length)
            {
                return(SecureBoolean.False(builder));
            }

            Wire result = left.Wires
                          .Zip(right.Wires, (leftWire, rightWire) => builder.Not(builder.Xor(leftWire, rightWire)))
                          .ToArray()
                          .AggregateDepthEfficient((x, y) => builder.And(x, y));

            return(new SecureBoolean(right.Builder, result));
        }