Beispiel #1
0
        private static KeccakStructRef InternalCompute(Span <byte> input)
        {
            var result = new KeccakStructRef();

            KeccakHash.ComputeHashBytesToSpan(input, result.Bytes);
            return(result);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        public static ValueKeccak Compute(ReadOnlySpan <byte> input)
        {
            if (input.Length == 0)
            {
                return(OfAnEmptyString);
            }

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

            KeccakHash.ComputeHashBytesToSpan(input, output);
            return(result);
        }