示例#1
0
        private void ComputeCICType()
        {
            Byte[] bootcodeBuffer = new Byte[Size];

            using (MemoryStream ms = new MemoryStream(bootcodeBuffer))
            {
                CopyCode(ms);
            }

            Crc32HashAlgorithm alg = new Crc32HashAlgorithm();

            alg.Initialize();
            alg.ComputeHash(bootcodeBuffer);

            switch (alg.CrcValue)
            {
            case 0x6170A4A1: m_CICType = CICKeyType.CIC_X101; break;

            case 0x90BB6CB5: m_CICType = CICKeyType.CIC_X102; break;

            case 0x0B050EE0: m_CICType = CICKeyType.CIC_X103; break;

            case 0x98BC2C86: m_CICType = CICKeyType.CIC_X105; break;

            case 0xACC8580A: m_CICType = CICKeyType.CIC_X106; break;

            default: m_CICType = CICKeyType.Unknown; break;
            }

            m_BootChecksum = alg.CrcValue;

#if DEBUG
            /* For future of converting the bootcode hashcodes to MD5 */
            MD5 md5 = MD5.Create();
            md5.Initialize();
            md5.ComputeHash(bootcodeBuffer);

            StringBuilder sb = new StringBuilder();
            foreach (Byte b in md5.Hash)
            {
                sb.AppendFormat("{0:X2}", b);
            }

            Debug.WriteLine(String.Format("MD5 Checksum for CIC Type ({0}): {1}", m_CICType, sb.ToString()));
#endif
        }
示例#2
0
        private void ComputeCICType()
        {
            Byte[] bootcodeBuffer = new Byte[Size];

            using (MemoryStream ms = new MemoryStream(bootcodeBuffer))
            {
                CopyCode(ms);
            }

            Crc32HashAlgorithm alg = new Crc32HashAlgorithm();
            alg.Initialize();
            alg.ComputeHash(bootcodeBuffer);

            switch (alg.CrcValue)
            {
                case 0x6170A4A1: m_CICType = CICKeyType.CIC_X101; break;
                case 0x90BB6CB5: m_CICType = CICKeyType.CIC_X102; break;
                case 0x0B050EE0: m_CICType = CICKeyType.CIC_X103; break;
                case 0x98BC2C86: m_CICType = CICKeyType.CIC_X105; break;
                case 0xACC8580A: m_CICType = CICKeyType.CIC_X106; break;
                default: m_CICType = CICKeyType.Unknown; break;
            }

            m_BootChecksum = alg.CrcValue;

            #if DEBUG
            /* For future of converting the bootcode hashcodes to MD5 */
            MD5 md5 = MD5.Create();
            md5.Initialize();
            md5.ComputeHash(bootcodeBuffer);

            StringBuilder sb = new StringBuilder();
            foreach (Byte b in md5.Hash)
            {
                sb.AppendFormat("{0:X2}", b);
            }

            Debug.WriteLine(String.Format("MD5 Checksum for CIC Type ({0}): {1}", m_CICType, sb.ToString()));
            #endif
        }