关于String 和 Base64 之间的互转 比较简单!

  public static String EncryptBase64Code(String text)
        
{
            Byte[] bufin 
= System.Text.ASCIIEncoding.UTF8.GetBytes(text);
            String result 
= Convert.ToBase64String(bufin, 0, bufin.Length);
            
return result;
        }


        
public static String DecryptBase64Code(String text)
        
{
            
try
            
{
                Byte[] bufout 
= Convert.FromBase64String(text);
                String result 
= System.Text.ASCIIEncoding.UTF8.GetString(bufout);
            
return result;
            }

            
catch
            
{
                
return text;
            }

        }
 
原文地址:https://www.cnblogs.com/SUNBOY/p/526037.html