这个帖子中有一个,自己去看看。http://expert.csdn.net/Expert/TopicView3.asp?id=1237771

解决方案 »

  1.   

    加什么密?
    字符串试试用这个:
    public static string Encrypt(string inputStr)
    {
    int len = inputStr.Length;

    int sum = 10;

    char[] encryptedChars = new char[len];
    for (int i=0; i<len; i++) 
    {
    encryptedChars[i] = (char)((int)inputStr[i] + sum);
    }

    char[] newNameStr = new char[len];
    for (int i=0; i<len; i++) 
    { // reverse the name
    newNameStr[i] = encryptedChars[len-1-i];
    } for (int i=0; i<len; i++) 
    { // reverse the name
    encryptedChars[i] = newNameStr[i];
    }

    return String.Intern(new String(encryptedChars));
    }public static string Decrypt(string inputStr)
    {
        int len = inputStr.Length;
        char[] decryptedChars = new char[len];
        for (int i=0; i<len; i++) 
        {
            decryptedChars[i] = (char)((int)inputStr[i] - 10);
        }     char[] newNameStr = new char[len];
        for (int i=0; i<len; i++) 
        { // reverse the name
            newNameStr[i] = decryptedChars[len-1-i];
        }    for (int i=0; i<len; i++) 
        { // reverse the name
            decryptedChars[i] = newNameStr[i];
        }    return String.Intern(new String(decryptedChars));
    }
      

  2.   

    .Net本身提供许多的加解密类,直接使用不是更好吗?
      

  3.   

    参考
    http://www.aspsky.net/article/list.asp?id=2637