【发布时间】:2011-10-31 09:07:57
【问题描述】:
我正在尝试“解码”以下 Base64 字符串:
OBFZDTcPCxlCKhdXCQ0kMQhKPh9uIgYIAQxALBtZAwUeOzcdcUEeW0dMO1kbPElWCV1ISFFKZ0kdWFlLAURPZhEFQVseXVtPOUUICVhMAzcfZ14AVEdIVVgfAUIBWVpOUlAeaUVMXFlKIy9rGUN0VF08Oz1BQYFfQc=
这是我对字符串本身的了解:
-
原始字符串首先通过以下代码传递:
private static string m000493(string p0, string p1) { StringBuilder builder = new StringBuilder(p0); StringBuilder builder2 = new StringBuilder(p1); StringBuilder builder3 = new StringBuilder(p0.Length); int num = 0; Label_0084: while (num < builder.Length) { int num2 = 0; while (num2 < p1.Length) { if ((num == builder.Length) || (num2 == builder2.Length)) { MessageBox.Show("EH?"); goto Label_0084; } char ch = builder[num]; char ch2 = builder2[num2]; ch = (char)(ch ^ ch2); builder3.Append(ch); num2++; num++; } } return m0001cd(builder3.ToString()); }代码中的
p1部分应该是字符串“_p0lizei.”。 -
然后通过以下代码将其转换为Base64字符串:
private static string m0001cd(string p0) { string str2; try { byte[] buffer = new byte[p0.Length]; str2 = Convert.ToBase64String(Encoding.UTF8.GetBytes(p0)); } catch (Exception exception) { throw new Exception("Error in base64Encode" + exception.Message); } return str2; }
问题是,如何解码 Base64 字符串,以便找出原始字符串是什么?
【问题讨论】:
-
我知道“为什么”在支持遗留的东西时通常是无关紧要的,但我需要知道...为什么最初的字符串是 Base64 编码的?!?? Base64 通常用于将二进制转换为基于文本的可移植版本以嵌入 XML 或 JSON - 可能用于跨 Web 服务层移动,而不是用于将字符串转换为编码字符串。
-
@barry - 在更老的帖子上回答你的老问题...我来到这里是因为我需要处理需要 base64 编码字符串的HTTP Authorization Header