Base64加密/解密

 1 /// <summary>
 2         /// Base64加密
 3         /// </summary>
 4         /// <param name="data"></param>
 5         /// <returns></returns>
 6         public static string Base64Encrypt(string data)
 7         {
 8             byte[] b = System.Text.Encoding.Default.GetBytes(data);
 9             return Convert.ToBase64String(b);
10         }
11         /// <summary>
12         /// Base64解密
13         /// </summary>
14         /// <param name="data"></param>
15         /// <returns></returns>
16         public static string Base64Decrypt(string data)
17         {
18             byte[] c = Convert.FromBase64String(data);
19             return System.Text.Encoding.Default.GetString(c);
20         }

 

posted @ 2020-11-10 14:59  .NET____小白  阅读(63)  评论(0编辑  收藏  举报