Esempio n. 1
0
        private static KeccakStructRef InternalCompute(Span <byte> input)
        {
            var result = new KeccakStructRef();

            KeccakHash.ComputeHashBytesToSpan(input, result.Bytes);
            return(result);
        }
Esempio n. 2
0
        public override bool Accepts(ref KeccakStructRef topic)
        {
            for (int i = 0; i < _subexpressions.Length; i++)
            {
                if (_subexpressions[i].Accepts(ref topic))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
        public static KeccakStructRef Compute(string input)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return(new KeccakStructRef(Keccak.OfAnEmptyString.Bytes));
            }

            var result = new KeccakStructRef();

            KeccakHash.ComputeHashBytesToSpan(System.Text.Encoding.UTF8.GetBytes(input), result.Bytes);
            return(result);
        }
Esempio n. 4
0
        public static KeccakStructRef Compute(Span <byte> input)
        {
            if (input.Length == 0)
            {
                return(new KeccakStructRef(Keccak.OfAnEmptyString.Bytes));
            }

            var result = new KeccakStructRef();

            KeccakHash.ComputeHashBytesToSpan(input, result.Bytes);
            return(result);
        }
Esempio n. 5
0
 public bool TryGetNext(out KeccakStructRef current)
 {
     if (_decoderContext.Position < _length)
     {
         _decoderContext.DecodeKeccakStructRef(out current);
         Index++;
         return(true);
     }
     else
     {
         current = new KeccakStructRef(Keccak.Zero.Bytes);
         return(false);
     }
 }
Esempio n. 6
0
 public TxReceiptStructRef(TxReceipt receipt)
 {
     StatusCode           = receipt.StatusCode;
     BlockNumber          = receipt.BlockNumber;
     BlockHash            = (receipt.BlockHash ?? Keccak.Zero).ToStructRef();
     TxHash               = (receipt.TxHash ?? Keccak.Zero).ToStructRef();
     Index                = receipt.Index;
     GasUsed              = receipt.GasUsed;
     GasUsedTotal         = receipt.GasUsedTotal;
     Sender               = (receipt.Sender ?? Address.Zero).ToStructRef();
     ContractAddress      = (receipt.ContractAddress ?? Address.Zero).ToStructRef();
     Recipient            = (receipt.Recipient ?? Address.Zero).ToStructRef();
     ReturnValue          = receipt.ReturnValue;
     PostTransactionState = (receipt.PostTransactionState ?? Keccak.Zero).ToStructRef();
     Bloom                = (receipt.Bloom ?? Core.Bloom.Empty).ToStructRef();
     Logs    = receipt.Logs;
     LogsRlp = Span <byte> .Empty;
     Error   = receipt.Error;
 }
Esempio n. 7
0
 public AddressStructRef(KeccakStructRef keccak) : this(keccak.Bytes.Slice(12, ByteLength))
 {
 }
Esempio n. 8
0
 public override bool Accepts(ref KeccakStructRef topic) => true;
Esempio n. 9
0
 public bool Equals(KeccakStructRef other) => Core.Extensions.Bytes.AreEqual(other.Bytes, Bytes);
Esempio n. 10
0
 public abstract bool Accepts(ref KeccakStructRef topic);