Example #1
0
        public bool VerifySignature(BigInteger hash, ECSignature signature)
        {
            hash = Curve.TruncateHash(hash);
            var w  = signature.S.ModInverse(Curve.Order);
            var u1 = (hash * w) % Curve.Order;
            var u2 = (signature.R * w) % Curve.Order;
            var p  = Curve.G * u1 + Point * u2;

            return(BigIntegerExt.ModEqual(signature.R, p.X, Curve.Order));
        }
Example #2
0
        public bool Has(ECPoint p)
        {
            if (p == ECPoint.Infinity)
            {
                return(true);
            }

            var left  = p.Y * p.Y;
            var right = p.X * p.X * p.X + A * p.X + B;

            return(BigIntegerExt.ModEqual(left, right, Modulus));
        }