Esempio n. 1
0
 public static String ComputeCrc64(this byte[] bytes, HashFormat hashFormat)
 {
     using (var hashImpl = new CRC64())
     {
         var hashBytes = hashImpl.ComputeHash(bytes);
         return(ConvertToString(hashBytes, hashFormat));
     }
 }
Esempio n. 2
0
 public static String ComputeCRC64(byte[] bytes)
 {
     using (var hashAlgorithmImpl = new CRC64())
     {
         var hashBytes = hashAlgorithmImpl.ComputeHash(bytes);
         return(String.Concat(hashBytes.Select(b => b.ToString("x2"))));
     }
 }
Esempio n. 3
0
        public static String GenerateHex64()
        {
            using (var crc64 = new CRC64())
            {
                var uniqText  = String.Concat(Guid.NewGuid(), Guid.NewGuid(), Environment.TickCount);
                var srcBytes  = Encoding.UTF32.GetBytes(uniqText);
                var hashBytes = crc64.ComputeHash(srcBytes);

                return(String.Join(String.Empty, hashBytes.Select(b => b.ToString("x2"))));
            }
        }
Esempio n. 4
0
        public static ulong GenerateInt64()
        {
            using (var crc64 = new CRC64())
            {
                var uniqText  = String.Concat(Guid.NewGuid(), Guid.NewGuid(), Environment.TickCount);
                var srcBytes  = Encoding.UTF32.GetBytes(uniqText);
                var hashBytes = crc64.ComputeHash(srcBytes);

                return(BitConverter.ToUInt64(hashBytes, 0));
            }
        }