Пример #1
0
        private Boolean CheckSig(Byte[] sig, PublicKey pubKey, UInt32 txInIndex, Script subScript, Transaction tx)
        {
            HashType hashType = (HashType)sig.Last();
            sig = sig.Take(sig.Length - 1).ToArray();

            Transaction txCopy = tx.CopyForSigning(txInIndex, subScript, hashType);

            Byte[] txHash = txCopy.ToBytes().Concat(new Byte[] { (Byte)hashType, 0x00, 0x00, 0x00 }).ToArray();
            txHash = sha256.ComputeHash(sha256.ComputeHash(txHash));

            return pubKey.VerifySignature(txHash, sig);
        }