예제 #1
0
        /// <summary>
        /// Computes the 32-bit city hash value for the specified string.
        /// </summary>
        /// <param name="value">The string to evaluate.</param>
        /// <returns>The computed 32-bit CityHash.</returns>
        /// <exception cref="System.ArgumentNullException">value</exception>
        /// <remarks>This function encodes the string using the unicode block (ISO/IEC 8859-1).</remarks>
        public static uint GetCityHash32(this string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            return(CityHash.CityHash32(value));
        }
예제 #2
0
        /// <summary>
        /// Computes the 64-bit city hash value for the specified string using a specific <paramref name="seed" />.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <param name="seed">Specifies the seed for the CityHash algorithm.</param>
        /// <returns>The computed 64-bit CityHash.</returns>
        /// <exception cref="System.ArgumentNullException">value</exception>
        /// <remarks>This function encodes the string using the unicode block (ISO/IEC 8859-1).</remarks>
        public static ulong GetCityHash64(this string value, ulong seed)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            return(CityHash.CityHash64(value, seed));
        }
예제 #3
0
        /// <summary>
        /// Computes the 128-bit city hash using a specific <paramref name="seed" />.
        /// This algorithm is tuned for strings of at least a few hundred bytes.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <param name="seed">Specifies the seed for the CityHash algorithm.</param>
        /// <returns>The 128-bit city hash.</returns>
        /// <exception cref="ArgumentNullException">value</exception>
        /// <remarks>This function encodes the string using the unicode block (ISO/IEC 8859-1).</remarks>
        public static UInt128 GetCityHash128(this string value, UInt128 seed)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            return(CityHash.CityHash128(value, seed));
        }