空字符串是否是有效的,长度为零字节的base64编码数据? [英] Is an empty string valid base64 encoded data of zero bytes length?
问题描述
我的一所大学告诉我,空字符串不是有效的base64编码数据字符串.我不认为这是真的(他太懒了以至于无法解析它),但是在仔细搜索甚至检查了 RFC 我还没有找到明确地说明如何在base64中正确编码零字节长度的blob的文档.
One of my colleges was telling me that the empty string is not a valid base64 encoded data string. I don't think this is true (he is too lazy to parse it), but after googling around a bit and even checking the RFC I have not found any documentation that explicitly states how to properly encode a blob of zero bytes length in base64.
所以,问题是:您是否具有一些官方文档的链接,这些文档明确指出了base64中应如何编码零字节?
So, the question is: Do you have a link to some official documentation that explicitly states how zero bytes should be encoded in base64?
推荐答案
根据 RFC 4648第10节,测试向量,
BASE64("") = ""
我认为倒数也必须成立.
I would assume the inverse must hold as well.
这篇关于空字符串是否是有效的,长度为零字节的base64编码数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!