Exemple #1
0
            /// <summary>
            /// Gets the hash of a byte array.
            /// </summary>
            /// <param name="bytes">The bytes.</param>
            /// <param name="seed">The seed.</param>
            /// <returns>The hash.</returns>
            public UInt192 GetHash(byte[] bytes, UInt192 seed)
            {
                UInt128 hash128 = MurmurHash3.Hash128(bytes, bytes.Length, UInt128.Create(seed.GetLow(), seed.GetMid()));
                ulong   hash64  = MurmurHash3.Hash64(bytes, bytes.Length, seed.GetHigh());

                return(UInt192.Create(hash128.GetLow(), hash128.GetHigh(), hash64));
            }
Exemple #2
0
 /// <summary>
 /// Gets the hash of a byte array.
 /// </summary>
 /// <param name="bytes">The bytes.</param>
 /// <param name="seed">The seed.</param>
 /// <returns>The hash.</returns>
 public static UInt128 GetHash(byte[] bytes, UInt128 seed)
 {
     // TODO: Have MurmurHash3 work on Span<T> instead.
     Microsoft.Azure.Documents.UInt128 hash128 = Microsoft.Azure.Documents.Routing.MurmurHash3.Hash128(
         bytes,
         bytes.Length,
         Microsoft.Azure.Documents.UInt128.Create(seed.GetLow(), seed.GetHigh()));
     return(UInt128.Create(hash128.GetLow(), hash128.GetHigh()));
 }