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 ECSignature Sign(BigInteger message)
        {
            message = Curve.TruncateHash(message);
            ECSignature signature = null;

            do
            {
                var random = BigIntegerExt.ModRandom(Curve.Order);
                signature = SignTruncated(message, random);
            } while (signature == null);
            return(signature);
        }
Example #3
0
 public bool VerifySignature(byte[] hash, ECSignature signature)
 {
     return(VerifySignature(BigIntegerExt.FromBigEndianBytes(hash), signature));
 }