通常情况下,数据库中存放的是加密后的密码。
比较常用的如MD5。给你段MD5的代码参考  public static string Md516(string ConvertString)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            string t2 = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8);
            t2 = t2.Replace("-", "");
            t2 = t2.ToLower();
            return t2;
        }

解决方案 »

  1.   

    public static string EncodeMd5(string pstrSource)
    {
    byte[] passBytes = System.Text.Encoding.ASCII.GetBytes(pstrSource.ToCharArray());
    MD5 md5 = new MD5CryptoServiceProvider();
    byte[] hashBytes = md5.ComputeHash(passBytes);
    string strDestination=string.Empty;
    foreach(int hash in hashBytes)
    strDestination += hash.ToString("x2");
    return strDestination;
    }