예제 #1
0
        public static VerifyMachineCode_BYTE GetEncode_BYTE()
        {
            VerifyMachineCode_BYTE ret = new VerifyMachineCode_BYTE();
            string str1 = ReadSystemHardDeviceParam.GetHardDisk_SerialNumber().Trim();
            string str2 = ReadSystemHardDeviceParam.GetCPU_SerialNumber().Trim();
            string str3 = ReadSystemHardDeviceParam.GetMacAddrs().Trim();
            string str4 = ReadSystemHardDeviceParam.GetMasterBoard_SerialNumber().Trim();

            byte[] b1 = Encoding.ASCII.GetBytes(str1);
            byte[] b2 = Encoding.ASCII.GetBytes(str2);
            byte[] b3 = Encoding.ASCII.GetBytes(str3);
            byte[] b4 = Encoding.ASCII.GetBytes(str4);
            for (int i = 0; i < 8; i++)
            {
                try
                {
                    ret.ID[i] = (byte)(b1[i] ^ b2[i] ^ b3[i] ^ b4[i]);
                }
                catch// (System.Exception ex)
                {
                    ret.ID[i] = (byte)'w';
                }
            }
            lcyHashCal lcy = new lcyHashCal();

            ret.Encode = lcy.HashCal(ret.ID, lcyNum);
            return(ret);
        }
예제 #2
0
        public static bool CheckEncode_BYTE(VerifyMachineCode_BYTE vc)
        {
            lcyHashCal lcy = new lcyHashCal();

            byte[] x = lcy.HashCal(vc.ID, lcyNum);
            for (int i = 0; i < 8; i++)
            {
                if (x[i] != vc.Encode[i])
                {
                    return(false);
                }
            }
            return(true);
        }