Esempio n. 1
0
        public static long HashToLong(string data)
        {
            uint hash1;
            uint hash2;

            PerfectHash.ComputeHash(Encoding.UTF8.GetBytes(data.ToUpper()), seed1: 0, seed2: 0, hash1: out hash1, hash2: out hash2);
            long hashedValue = ((long)hash1 << 32) | (long)hash2;

            return(hashedValue);
        }
Esempio n. 2
0
        public static short HashToShort(string data)
        {
            uint hash1;
            uint hash2;

            PerfectHash.ComputeHash(Encoding.UTF8.GetBytes(data.ToUpper()), seed1: 0, seed2: 0, hash1: out hash1, hash2: out hash2);
            long hashedValue = hash1 ^ hash2;

            return((short)hashedValue);
        }
Esempio n. 3
0
        public static long HashToLong(string data)
        {
            uint hash1;
            uint hash2;

#if WINDOWS_UWP
            PerfectHash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(data.ToUpper()), seed1: 0, seed2: 0, hash1: out hash1, hash2: out hash2);
#else
            PerfectHash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(data.ToUpper(CultureInfo.InvariantCulture)), seed1: 0, seed2: 0, hash1: out hash1, hash2: out hash2);
#endif
            long hashedValue = ((long)hash1 << 32) | (long)hash2;

            return(hashedValue);
        }