コード例 #1
0
        /// <summary>
        /// 得到以数字9开头,长度在9位以内的数字
        /// 1、对输入的字符串进行MD5加密
        /// 2、长度大于等于9位时,返回"9" + input.Substring(1, 8)
        /// 3、长度小于9位时,返回"9" + input
        /// </summary>
        /// <param name="strText"></param>
        /// <returns></returns>
        public static int MD5D(string strText)
        {
            var           data      = Encoding.UTF8.GetBytes(strText);
            var           encryData = Md5.Encrypt(data);
            StringBuilder builder   = new StringBuilder();

            foreach (byte num in encryData)
            {
                builder.Append(num.ToString("D", CultureInfo.CurrentCulture).ToLower());
            }
            string input = builder.ToString();

            if (input.Length >= 9)
            {
                input = "9" + input.Substring(1, 8);
            }
            else
            {
                input = "9" + input;
            }
            return(DataConverter.CLng(input));
        }
コード例 #2
0
 /// <summary>
 /// 对输入的字符串进行gb2312编码后在用MD5加密
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public static string MD5GB2312(string input)
 {
     return(Md5.EncryptHexString(input, Encoding.GetEncoding("gb2312")));
 }
コード例 #3
0
 /// <summary>
 /// 对输入的字符串进行MD5加密
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public static string MD5(string input)
 {
     return(Md5.EncryptHexString(input));
 }