Exemplo n.º 1
0
        public static Hash64 GenerateHash64(
            ReadOnlySpan <byte> bytes,
            IHashFunction?hashFunction = null)
        {
            if (hashFunction is null)
            {
                hashFunction = DefaultHashFunction.Get64Bit();
            }
            else
            {
                HashFunctionValidator.Validate(hashFunction, 8);
            }

            return(GenerateHashImpl(bytes, hashFunction));
        }
Exemplo n.º 2
0
        public static Hash64 GenerateJsonHash64(
            object obj,
            IHashFunction?hashFunction              = null,
            JsonWriterOptions writerOptions         = default,
            JsonSerializerOptions?serializerOptions = null)
        {
            if (hashFunction is null)
            {
                hashFunction = DefaultHashFunction.Get64Bit();
            }
            else
            {
                HashFunctionValidator.Validate(hashFunction, 8);
            }

            return(GenerateJsonHashImpl(obj, hashFunction, writerOptions, serializerOptions));
        }
Exemplo n.º 3
0
        public static Hash64 GenerateHash64(
            ReadOnlySpan <char> input,
            IHashFunction?hashFunction = null)
        {
            if (hashFunction is null)
            {
                hashFunction = DefaultHashFunction.Get64Bit();
            }
            else
            {
                HashFunctionValidator.Validate(hashFunction, 8);
            }

            var bytes = MemoryMarshal.Cast <char, byte>(input);

            return(GenerateHashImpl(bytes, hashFunction));
        }