src/Inedo.UPack/AH.cs
/// <summary>
/// Returns a hash code for arbitrary binary data.
/// </summary>
/// <param name="array">The array containing the data to hash.</param>
/// <returns>The hash code.</returns>
Returns a hash code for arbitrary binary data.
Returns a hash code for arbitrary binary data .
public static int GetHashCode(byte[] array)
        {
            if (array == null || array.Length == 0)
                return 0;
            int length = array.Length;
            unsafe
            {
                unchecked
                {
                    fixed (byte* ptr = array)
                    {
                        byte* p = ptr;
                        uint h = 2166136261u;
                        int i;
                        for (i = 0; i < length; i++)
                            h = (h * 16777619u) ^ p[i];
                        return (int)h;
                    }
                }
            }
        }
public static int GetHashCode ( byte [ ] array ) { if ( array == null || array . Length == 0 ) return 0 ; int length = array . Length ; unsafe { unchecked { fixed ( byte * ptr = array ) { byte * p = ptr ; uint h = 2166136261u ; int i ; for ( i = 0 ; i < length ; i ++ ) h = ( h * 16777619u ) ^ p [ i ] ; return ( int ) h ; } } } }
Returns a hash code for arbitrary binary data.
Returns a hash code for arbitrary binary data .
The hash code.
The hash code .
array
byte[]
The array containing the data to hash.
The array containing the data to hash .