Perl - 何时进行 Base64 解码?
我有一个有趣的问题。我正在开发一个 Perl 脚本,它接受各种字符串,有些是 base64 编码的,有些不是。
该数据结构是动态的,根据第三方应用程序的输入生成。我没有现成的方法来提前知道哪些字段是 Base64 编码的,哪些不是。
我看过的各种解决方案都涉及输入数据的正则表达式。不幸的是,如果数据具有相同的严格字母数字结构,那么这些都会失败。
如何确定哪些字符串是真正经过 Base64 编码的?
I have an interesting problem. I'm working on a Perl script that takes in a variety of strings, some base64 encoded, others not.
This data structure is dynamic, generated from a input from third party application. I don't have a ready way to know in advance which of these fields are base64 encoded and those which are not.
The various solutions I have looked at all involved regular expressions on the input data. Unfortunately these all fail if the data is of the same strictly alphanumeric structure.
How can I determine which strings are truly base64 encoded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终对临时变量的所有内容进行解码,并看到输出包含任何高八位字节输出。
I ended up going with doing a decode on everything to a temporary variable and seeing of the output contains any high octet output.