Beispiel #1
0
        public String Key1()
        {
            //DateTime
            string CoonTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            //KEY
            //拼接字符串:随机码|密钥|bw8848|调用时间
            Random random   = new Random();
            int    RanNum   = random.Next(11111111, 99999999);
            string password = "******";

            string str = RanNum.ToString() + "|" + password + "|" + "bw8848" + "|" + CoonTime;
            //KEY =随机码左4位 + MD5码 + 随机码右4位
            string key = RanNum.ToString().Substring(0, 4) + Md5Utils.GetMD5WithString(str.Trim()) + RanNum.ToString().Substring(4, 4);

            /*  //DateTime
             * string CoonTime = DateTime.Now.ToString("yyyyMMddHHmmss");
             *
             *       //KEY
             *       //拼接字符串:随机码|密钥|bw8848|调用时间
             *       Random random = new Random();
             *       int RanNum = random.Next(10000000, 99999999);
             *       string password = "******";
             *
             *       string str = RanNum.ToString() + "|" + password + "|" + "bw8848" + "|" + CoonTime;
             *       //KEY =随机码左4位 + MD5码 + 随机码右4位
             *       string key = RanNum.ToString().Substring(0, 4) + Md5Utils.GetMD5WithString(str.Trim()) + RanNum.ToString().Substring(4, 4);*/

            return(key);
        }
Beispiel #2
0
        public String Key()
        {
            /*      string md5 = "";
             *     string key = "";
             *     //string date= DateTime.Now.ToString("yyyyMMddhhmmss");//12小时制
             *
             *     Random rd = new Random();
             *    // Random r4 = new Random();
             *    // Random l4 = new Random();
             *     for (int i = 0; i <8; i++)
             *     {
             *          //无参即为使用系统时钟为种子
             *         key = key+rd.Next(0,9).ToString();
             *     }
             *     md5 = key + "|bwsoft|bw8848|" + DateTime.Now.ToString("yyyyMMddHHmmss");
             *     key = Md5Utils.StrToMD5(md5);
             *     key = rd.ToString().Substring(0, 4) + key + rd.ToString().Substring(4, 4);
             *     return key.ToUpper();
             */
            //DateTime
            string CoonTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            //KEY
            //拼接字符串:随机码|密钥|bw8848|调用时间
            Random random   = new Random();
            int    RanNum   = random.Next(10000000, 99999999);
            string password = "******";

            string str = RanNum.ToString() + "|" + password + "|" + "bw8848" + "|" + CoonTime;
            //KEY =随机码左4位 + MD5码 + 随机码右4位
            string key = RanNum.ToString().Substring(0, 4) + Md5Utils.StrToMD5(str.Trim()) + RanNum.ToString().Substring(4, 4);

            return(key);
        }
Beispiel #3
0
        public String Key2()
        {
            string md5 = "";
            string key = "";
            //string date= DateTime.Now.ToString("yyyyMMddhhmmss");//12小时制

            Random rd = new Random();
            // Random r4 = new Random();
            // Random l4 = new Random();

                        //无参即为使用系统时钟为种子
            string keyy = rd.Next(10000000, 99999999).ToString();

            md5 = keyy + "|bwsoft|bw8848|" + DateTime.Now.ToString("yyyyMMddHHmmss");
            key = Md5Utils.MD5Encrypt(md5);
            key = keyy.ToString().Substring(0, 4) + key + keyy.ToString().Substring(4, 4);
            return(key.ToUpper());

            /*  //DateTime
             * string CoonTime = DateTime.Now.ToString("yyyyMMddHHmmss");
             *
             * //KEY
             * //拼接字符串:随机码|密钥|bw8848|调用时间
             * Random random = new Random();
             * int RanNum = random.Next(10000000, 99999999);
             * string password = "******";
             *
             * string str = RanNum.ToString() + "|" + password + "|" + "bw8848" + "|" + CoonTime;
             * //KEY =随机码左4位 + MD5码 + 随机码右4位
             * string key = RanNum.ToString().Substring(0, 4) + Md5Utils.MD5Encrypt(str.Trim()) + RanNum.ToString().Substring(4, 4);
             *
             * return key;*/
        }