base64编码和解码

string Str = "abc";



// 编码

string BaseStr = Convert.ToBase64String(Encoding.UTF8.GetBytes(Str));



Console.WriteLine(BaseStr);// YWJj



// 解码

string OldStr = Encoding.GetEncoding("utf-8").GetString(Convert.FromBase64String(BaseStr));



Console.WriteLine(OldStr); // abc

 

你可能感兴趣的:(base64)