src/Orleans.Core.Abstractions/IDs/JenkinsHash.cs
/// <summary>
/// Computes a hash digest of the input.
/// </summary>
/// <param name="data">
/// The input data.
/// </param>
/// <returns>
/// A hash digest of the input.
/// </returns>
Computes a hash digest of the input.
Computes a hash digest of the input .
public static uint ComputeHash(ReadOnlySpan<byte> data)
        {
            int len = data.Length;
            uint a = 0x9e3779b9;
            uint b = a;
            uint c = 0;
            int i = 0;
            while (i + 12 <= len)
            {
                a += (uint)data[i++] |
                    ((uint)data[i++] << 8) |
                    ((uint)data[i++] << 16) |
                    ((uint)data[i++] << 24);
                b += (uint)data[i++] |
                    ((uint)data[i++] << 8) |
                    ((uint)data[i++] << 16) |
                    ((uint)data[i++] << 24);
                c += (uint)data[i++] |
                    ((uint)data[i++] << 8) |
                    ((uint)data[i++] << 16) |
                    ((uint)data[i++] << 24);
                Mix(ref a, ref b, ref c);
            }
            c += (uint)len;
            if (i < len)
                a += data[i++];
            if (i < len)
                a += (uint)data[i++] << 8;
            if (i < len)
                a += (uint)data[i++] << 16;
            if (i < len)
                a += (uint)data[i++] << 24;
            if (i < len)
                b += (uint)data[i++];
            if (i < len)
                b += (uint)data[i++] << 8;
            if (i < len)
                b += (uint)data[i++] << 16;
            if (i < len)
                b += (uint)data[i++] << 24;
            if (i < len)
                c += (uint)data[i++] << 8;
            if (i < len)
                c += (uint)data[i++] << 16;
            if (i < len)
                c += (uint)data[i++] << 24;
            Mix(ref a, ref b, ref c);
            return c;
        }
public static uint ComputeHash ( ReadOnlySpan < byte > data ) { int len = data . Length ; uint a = 0x9e3779b9 ; uint b = a ; uint c = 0 ; int i = 0 ; while ( i + 12 <= len ) { a += ( uint ) data [ i ++ ] | ( ( uint ) data [ i ++ ] << 8 ) | ( ( uint ) data [ i ++ ] << 16 ) | ( ( uint ) data [ i ++ ] << 24 ) ; b += ( uint ) data [ i ++ ] | ( ( uint ) data [ i ++ ] << 8 ) | ( ( uint ) data [ i ++ ] << 16 ) | ( ( uint ) data [ i ++ ] << 24 ) ; c += ( uint ) data [ i ++ ] | ( ( uint ) data [ i ++ ] << 8 ) | ( ( uint ) data [ i ++ ] << 16 ) | ( ( uint ) data [ i ++ ] << 24 ) ; Mix ( ref a , ref b , ref c ) ; } c += ( uint ) len ; if ( i < len ) a += data [ i ++ ] ; if ( i < len ) a += ( uint ) data [ i ++ ] << 8 ; if ( i < len ) a += ( uint ) data [ i ++ ] << 16 ; if ( i < len ) a += ( uint ) data [ i ++ ] << 24 ; if ( i < len ) b += ( uint ) data [ i ++ ] ; if ( i < len ) b += ( uint ) data [ i ++ ] << 8 ; if ( i < len ) b += ( uint ) data [ i ++ ] << 16 ; if ( i < len ) b += ( uint ) data [ i ++ ] << 24 ; if ( i < len ) c += ( uint ) data [ i ++ ] << 8 ; if ( i < len ) c += ( uint ) data [ i ++ ] << 16 ; if ( i < len ) c += ( uint ) data [ i ++ ] << 24 ; Mix ( ref a , ref b , ref c ) ; return c ; }
Computes a hash digest of the input.
Computes a hash digest of the input .
A hash digest of the input.
A hash digest of the input .
data
ReadOnlySpan<byte>
The input data.
The input data .