public static byte[] ComputeHash(byte[] userContextIdBinary, byte[] timestampBinary, string logOnUniqueKey, out long keyIndex, out int segmentIndex)
        {
            long ticks = BitConverter.ToInt64(timestampBinary, 0);

            byte[] array;
            if (Canary15DataManager.GetEntry(ticks, out array, out keyIndex, out segmentIndex))
            {
                byte[] bytes = new UnicodeEncoding().GetBytes(logOnUniqueKey);
                int    num   = userContextIdBinary.Length + timestampBinary.Length + bytes.Length;
                num += array.Length;
                byte[] array2 = new byte[num];
                int    num2   = 0;
                userContextIdBinary.CopyTo(array2, num2);
                num2 += userContextIdBinary.Length;
                timestampBinary.CopyTo(array2, num2);
                num2 += timestampBinary.Length;
                bytes.CopyTo(array2, num2);
                num2 += bytes.Length;
                array.CopyTo(array2, num2);
                byte[] result;
                using (SHA256Cng sha256Cng = new SHA256Cng())
                {
                    result = sha256Cng.ComputeHash(array2);
                    sha256Cng.Clear();
                }
                return(result);
            }
            return(null);
        }
Example #2
0
        // Token: 0x060007B8 RID: 1976 RVA: 0x0003A87C File Offset: 0x00038A7C
        private static byte[] ComputeHash(byte[] userContextIdBinary, byte[] timeStampBinary, string logonUniqueKey)
        {
            int num = 0;

            byte[] bytes = new UnicodeEncoding().GetBytes(logonUniqueKey);
            byte[] array = new byte[userContextIdBinary.Length + timeStampBinary.Length + bytes.Length + Canary.adObjectIdsBinary.Length];
            userContextIdBinary.CopyTo(array, num);
            num += userContextIdBinary.Length;
            timeStampBinary.CopyTo(array, num);
            num += timeStampBinary.Length;
            bytes.CopyTo(array, num);
            num += bytes.Length;
            Canary.adObjectIdsBinary.CopyTo(array, num);
            byte[] result;
            using (SHA256Cng sha256Cng = new SHA256Cng())
            {
                result = sha256Cng.ComputeHash(array);
                sha256Cng.Clear();
            }
            return(result);
        }