Exemplo n.º 1
0
        /// <summary>
        /// Check whether a signature is normalized (lower-S).
        /// </summary>
        /// <param name="vchSig"></param>
        /// <returns></returns>
        public static bool CheckLowS(ReadOnlySequence<byte> vchSig)
        {
            var sig = new byte[64];
            var input = vchSig.ToSpan();

            using (var secp256k1 = new Secp256k1()) {

                if (!secp256k1.SignatureParseDerLax(sig, input)) return false;
                return !secp256k1.SignatureNormalize(Span<byte>.Empty, input);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check whether a signature is normalized (lower-S).
        /// </summary>
        /// <param name="vchSig"></param>
        /// <returns></returns>
        public static bool CheckLowS(ReadOnlyByteSequence vchSig)
        {
            var sig   = new byte[64];
            var input = (ReadOnlyByteSpan)vchSig;

            using var library = new Secp256k1();
            if (!library.SignatureParseDerLax(sig, input))
            {
                return(false);
            }
            return(!library.SignatureNormalize(Span <byte> .Empty, input));
        }