MD5加密

 ------
 sSql = "select userid from users where halt = 0 and userid=" +
                            _oCommon.procStr(UserID) + " and password="
                            + _oCommon.procStr(_oCommon.MD5(PW));

-------
   /// <summary>
        /// MD5加密
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public string MD5(string s)
        {
            byte[] HashData;
            if (String.IsNullOrEmpty(s))
                s = "";
            System.Security.Cryptography.MD5CryptoServiceProvider MD5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
            HashData = MD5.ComputeHash(System.Text.Encoding.GetEncoding("GB2312").GetBytes(s));
            return Convert.ToBase64String(HashData);
        }

posted on 2007-01-26 17:05  玄新  阅读(215)  评论(0编辑  收藏  举报

导航