Пример #1
0
        public ValueKeccak ToStructRef()
        {
            ValueKeccak valueKeccak = new ValueKeccak();

            Bytes.AsSpan().CopyTo(valueKeccak.BytesAsSpan);
            return(valueKeccak);
        }
Пример #2
0
        private static ValueKeccak InternalCompute(byte[] input)
        {
            var   result = new ValueKeccak();
            byte *ptr    = result.Bytes;
            var   output = new Span <byte>(ptr, KeccakHash.HASH_SIZE);

            KeccakHash.ComputeHashBytesToSpan(input, output);
            return(result);
        }
Пример #3
0
        public static ValueKeccak Compute(Span <byte> input)
        {
            if (input == null || input.Length == 0)
            {
                return(OfAnEmptyString);
            }

            var   result = new ValueKeccak();
            byte *ptr    = result.Bytes;
            var   output = new Span <byte>(ptr, KeccakHash.HASH_SIZE);

            KeccakHash.ComputeHashBytesToSpan(input, output);
            return(result);
        }
Пример #4
0
        private Address ComputeAddress()
        {
            Span <byte> hash = ValueKeccak.Compute(Bytes).BytesAsSpan;

            return(new Address(hash.Slice(12).ToArray()));
        }
Пример #5
0
        public static Address ComputeAddress(Span <byte> publicKeyBytes)
        {
            Span <byte> hash = ValueKeccak.Compute(publicKeyBytes).BytesAsSpan;

            return(new Address(hash.Slice(12).ToArray()));
        }