示例#1
0
        public static KzUInt160 RIPEMD160(ReadOnlySequence <byte> data)
        {
            var h = new KzUInt160();

            RIPEMD160(data, h.Span);
            return(h);
        }
示例#2
0
        public static KzUInt160 SHA1(this ReadOnlySpan <byte> data)
        {
            var hash = new KzUInt160();

            SHA1(data, hash.Span);
            return(hash);
        }
示例#3
0
文件: KzBlock.cs 项目: wy000000/KzBsv
        public IEnumerable <(KzTransaction tx, KzTxOut o, int i)> GetOutputsSendingToAddresses(KzUInt160[] addresses)
        {
            var v = new KzUInt160();

            foreach (var tx in Txs)
            {
                foreach (var o in tx.Vout)
                {
                    foreach (var op in o.ScriptPub.Decode())
                    {
                        if (op.Code == KzOpcode.OP_PUSH20)
                        {
                            op.Data.ToSpan().CopyTo(v.Span);
                            var i = Array.BinarySearch <KzUInt160>(addresses, v);
                            if (i >= 0)
                            {
                                yield return(tx, o, i);
                            }
                        }
                    }
                }
            }
        }
示例#4
0
 public static bool VerifyMessage(this KzUInt160 keyID, string message, string signature) => VerifyMessage(keyID, message.UTF8ToBytes(), Convert.FromBase64String(signature));
示例#5
0
        public static bool VerifyMessage(this KzUInt160 keyID, ReadOnlySpan <byte> message, ReadOnlySpan <byte> signature)
        {
            var rkey = RecoverPubKeyFromMessage(message, signature);

            return(rkey != null && rkey.GetID() == keyID);
        }
示例#6
0
 public IKzWriter Add(KzUInt160 v)
 {
     v.Span.CopyTo(Memory.Span.Slice(Length)); Length += 20; return(this);
 }
示例#7
0
 public IKzWriter Add(KzUInt160 v)
 {
     Length += 20; return(this);
 }
示例#8
0
 public IKzWriter Add(KzUInt160 v)
 {
     _alg.TransformBlock(v.ReadOnlySpan); return(this);
 }