不可逆:4个e
unsafe static void Main(string[] args)
{
byte[] by = new byte[256];
for (int i = 0; i < by.Length; i++)
by[i] = (byte)i;
string s = Encoding.Unicode.GetString(by);
byte[] by2 = Encoding.Unicode.GetBytes(s);
for (int i = 0; i < by.Length; i++)
{
if (by[i] != by2[i])
{
Console.Write('e');
}
}
Console.ReadKey();
}
不 可逆:
unsafe static void Main(string[] args)
{
byte[] by = new byte[256];
for (int i = 0; i < by.Length; i++)
by[i] = (byte)(i + 200);
string s = Encoding.Default.GetString(by);
byte[] by2 = Encoding.Default.GetBytes(s);
for (int i = 0; i < by.Length; i++)
{
if (by[i] != by2[i])
{
Console.Write('e');
}
}
Console.ReadKey();
}
标签:Console,string,Encoding,C#,可逆,Length,Default,int,byte
From: https://blog.51cto.com/u_16076050/6195825