/* * 生成有效期注册码 */ public static string generateWithLimitDay(int day, string machineCode) { string code1 = machineCode + Params.salt1 + day; string code2 = Params.salt2 + machineCode; string md51 = Md5Util.generate(code1); string md52 = Md5Util.generate(code2); string md53 = Md5Util.generate(md51 + md52); return(md53); }
/* * 生成注册码 */ public static string generate(string machineCode) { string code1 = machineCode + Params.salt1; string code2 = Params.salt2 + machineCode; string md51 = Md5Util.generate(code1); string md52 = Md5Util.generate(code2); string md53 = Md5Util.generate(md51 + md52); return(md53); }
/* * 生成校验码 */ public static string generateValidateCode(Cfg2 cfg2, string machineCode) { string AppSecret = Md5Util.generate(Params.salt1 + machineCode + Params.salt2); string str = cfg2.sd; str = str + "&" + cfg2.cd; str = str + "&" + cfg2.ld; str = str + "&" + cfg2.rg1; str = str + "&" + cfg2.rg3; str = str + "&" + AppSecret; return(Md5Util.generate(str)); }
public static string GetMachineCodeString() { string machineCodeString = string.Empty; if (machineCodeUtil == null) { machineCodeUtil = new MachineCodeUtil(); } machineCodeString = "PC." + machineCodeUtil.GetCpuInfo() + "." + machineCodeUtil.GetHardId() // + "." + machineCodeUtil.GetMacAddress() ; machineCodeString = Md5Util.generate(machineCodeString); return(machineCodeString); }