BASE64的编码解码
//base64编码
string strBase = "hello world";
byte[] bytStr = System.Text.Encoding.Default.GetBytes(strBase);
string strBase64 = Convert.ToBase64String(bytStr);
Console.WriteLine("strBase64:{0} length:{1}",strBase64,strBase64.Length);
//base解吗
byte[] byts = Convert.FromBase64String(strBase64);
string strSource = System.Text.Encoding.Default.GetString(byts);
Console.WriteLine("source:{0} lenght:{1}",strSource,strSource.Length);
string strBase = "hello world";
byte[] bytStr = System.Text.Encoding.Default.GetBytes(strBase);
string strBase64 = Convert.ToBase64String(bytStr);
Console.WriteLine("strBase64:{0} length:{1}",strBase64,strBase64.Length);
//base解吗
byte[] byts = Convert.FromBase64String(strBase64);
string strSource = System.Text.Encoding.Default.GetString(byts);
Console.WriteLine("source:{0} lenght:{1}",strSource,strSource.Length);
posted on 2004-08-13 14:42 HelloSnoopy 阅读(514) 评论(0) 编辑 收藏 举报