예제 #1
0
파일: Hashing.cs 프로젝트: lanicon/KVLite-1
 /// <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));
     }
 }
예제 #2
0
파일: Hashing.cs 프로젝트: lanicon/KVLite-1
 /// <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);
     }
 }