public static KzUInt160 RIPEMD160(ReadOnlySequence <byte> data) { var h = new KzUInt160(); RIPEMD160(data, h.Span); return(h); }
public static KzUInt160 SHA1(this ReadOnlySpan <byte> data) { var hash = new KzUInt160(); SHA1(data, hash.Span); return(hash); }
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); } } } } } }
public static bool VerifyMessage(this KzUInt160 keyID, string message, string signature) => VerifyMessage(keyID, message.UTF8ToBytes(), Convert.FromBase64String(signature));
public static bool VerifyMessage(this KzUInt160 keyID, ReadOnlySpan <byte> message, ReadOnlySpan <byte> signature) { var rkey = RecoverPubKeyFromMessage(message, signature); return(rkey != null && rkey.GetID() == keyID); }
public IKzWriter Add(KzUInt160 v) { v.Span.CopyTo(Memory.Span.Slice(Length)); Length += 20; return(this); }
public IKzWriter Add(KzUInt160 v) { Length += 20; return(this); }
public IKzWriter Add(KzUInt160 v) { _alg.TransformBlock(v.ReadOnlySpan); return(this); }