.NET中进行Base64加密解密
1 /// <summary> 2 /// Base64加密 3 /// </summary> 4 /// <param name="Message"></param> 5 /// <returns></returns> 6 public string Base64Code(string Message) 7 { 8 byte[] bytes = Encoding.Default.GetBytes(Message); 9 return Convert.ToBase64String(bytes); 10 } 11 /// <summary> 12 /// Base64解密 13 /// </summary> 14 /// <param name="Message"></param> 15 /// <returns></returns> 16 public string Base64Decode(string Message) 17 { 18 byte[] bytes = Convert.FromBase64String(Message); 19 return Encoding.Default.GetString(bytes); 20 }