.NET中进行Base64加密解密

      /// <summary>  
     /// Base64加密  
     /// </summary>  
     /// <param name="Message"></param>  
     /// <returns></returns>  
     public string Base64Code(string Message)  
     {  
     byte[] bytes = Encoding.Default.GetBytes(Message);  
     return Convert.ToBase64String(bytes);  
     }  
     /// <summary>  
     /// Base64解密  
     /// </summary>  
     /// <param name="Message"></param>  
     /// <returns></returns>  
     public string Base64Decode(string Message)  
     {  
     byte[] bytes = Convert.FromBase64String(Message);  
     return Encoding.Default.GetString(bytes);  
     }  

 

posted @ 2020-12-23 20:56  竹林听雨行  阅读(385)  评论(0编辑  收藏  举报