如何解码 Base64 编码的字符串?
我正在尝试“解码”以下 Base64 字符串:
OBFZDTcPCxlCKhdXCQ0kMQhKPh9uIgYIAQxALBtZAwUeOzcdcUEeW0dMO1kbPElWCV1ISFFKZ0kdWFlAURPZhEFQV seXVtPOUUICVhMAzcfZ14AVEdIVVgfAUIBWVpOUlAeaUVMXFlKIy9rGUN0VF08Oz1POxFfTCcVFw1LMQNbBQYWAQ==
这是我对字符串本身的了解:
原始字符串首先通过以下代码传递:
私有静态字符串 m000493(字符串 p0, 字符串 p1) { StringBuilder 构建器 = new StringBuilder(p0); StringBuilder builder2 = new StringBuilder(p1); StringBuilder builder3 = new StringBuilder(p0.Length); 整数数=0; 标签_0084: while (num < builder.Length) { 整数 num2 = 0; while (num2 < p1.Length) { if ((num == builder.Length) || (num2 == builder2.Length)) { MessageBox.Show("呃?"); 转到标签_0084; } char ch = 构建器[编号]; char ch2 = builder2[num2]; ch = (char)(ch ^ ch2); builder3.Append(ch); num2++; 数++; } } 返回 m0001cd(builder3.ToString()); }
代码中的
p1
部分应该是字符串“_p0lizei.
”。然后通过以下代码将其转换为 Base64 字符串:
私有静态字符串 m0001cd(字符串 p0) { 字符串str2; 尝试 { byte[] 缓冲区 = 新字节[p0.Length]; str2 = Convert.ToBase64String(Encoding.UTF8.GetBytes(p0)); } catch(异常异常) { 抛出新的异常(“base64Encode 错误”+Exception.Message); } 返回str2; }
问题是,如何解码 Base64 字符串以便找出原始字符串是什么?
I am trying to "decode" this following Base64 string:
OBFZDTcPCxlCKhdXCQ0kMQhKPh9uIgYIAQxALBtZAwUeOzcdcUEeW0dMO1kbPElWCV1ISFFKZ0kdWFlLAURPZhEFQVseXVtPOUUICVhMAzcfZ14AVEdIVVgfAUIBWVpOUlAeaUVMXFlKIy9rGUN0VF08Oz1POxFfTCcVFw1LMQNbBQYWAQ==
This is what I know about the string itself:
The original string is first passed through the following code:
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()); }
The
p1
part in the code is supposed to be the string "_p0lizei.
".It is then converted to a Base64 string by the following code:
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; }
The question is, how do I decode the Base64 string so that I can find out what the original string is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
简单的:
Simple:
m000493
方法似乎执行某种 XOR 加密。这意味着可以使用相同的方法对文本进行编码和解码。您所要做的就是反转m0001cd
:将
return m0001cd(builder3.ToString());
更改为return builder3.ToString();
。The
m000493
method seems to perform some kind of XOR encryption. This means that the same method can be used for both encoding and decoding the text. All you have to do is reversem0001cd
:with
return m0001cd(builder3.ToString());
changed toreturn builder3.ToString();
.