Example #1
0
 /// <summary>
 ///   Hashes given partition and key.
 /// </summary>
 /// <param name="partition">Partition.</param>
 /// <param name="key">Key.</param>
 /// <returns>Long hash for given partition and key.</returns>
 public static long HashPartitionAndKey(string partition, string key)
 {
     unchecked
     {
         var pHash = (long)XXHash32.CalculateRaw(partition) << 32;
         return(pHash + XXHash32.CalculateRaw(key));
     }
 }
Example #2
0
 /// <summary>
 ///   Hashes given partition; returns null if partition is null.
 /// </summary>
 /// <param name="partition">Partition.</param>
 /// <returns>Long hash for given partition, null if partition is null.</returns>
 public static long?HashPartition(string partition)
 {
     if (partition == null)
     {
         return(new long?());
     }
     unchecked
     {
         return((long)XXHash32.CalculateRaw(partition) << 32);
     }
 }