我在别人的代码里移植了一断,但只有加密部分,希望哪位高手帮我写出对应的解密部分!
public static string strPassword(string enterPassword)
  {
   byte[] passwordBytes = Encoding.ASCII.GetBytes(enterPassword);
   return Convert.ToBase64String(passwordBytes);
  }

解决方案 »

  1.   

    byte[] buffer = Convert.FromBase64String(strPassword('dadadfadf'));
    string str = Encoding.Unicode.GetString(buffer);
      

  2.   

    你前面是ASCII的,那么就用Encoding.ASCII.GetString(buffer);
      

  3.   

    参考
    http://www.cnblogs.com/jht/archive/2005/07/09/189333.html
      

  4.   

      byte[] passwordBytes = Encoding.ASCII.GetBytes(enterPassword);
      return Convert.ToBase64String(passwordBytes); 
    第一个是将enterPassword字符串转化成二进制的编码
    第二个是将二进制编码转化成string你想要加密、解密功能请看http://thingoose.spaces.live.com/default.aspx?_c01_BlogPart=blogentry&_c=BlogPart&handle=cns!4C9E3C7193170E9C!330