Ejemplo n.º 1
0
 internal unsafe static long HashString2Int64Strong(string s)
 {
     if (s != null && s.Length != 0)
     {
         byte[] bytes     = BitHelper.GetBytes(s);
         SHA256 hash      = new SHA256CryptoServiceProvider();
         byte[] hashBytes = hash.ComputeHash(bytes);
         return(BitHelper.ToInt64(hashBytes, 0) ^ BitHelper.ToInt64(hashBytes, 8) ^ BitHelper.ToInt64(hashBytes, 24));
     }
     return(0);
 }
Ejemplo n.º 2
0
 internal static long Guid2CellId(Guid guid)
 {
     byte[] guidByteArray = guid.ToByteArray();
     guidByteArray[8] = guidByteArray[0];
     return(BitHelper.ToInt64(guidByteArray, 8));
 }