3 位编码 = 八进制; 4 位编码 = 十六进制; 5 位编码 =?
是否有一种编码以 5 位为一组来编码二进制数据?
AZ 包含 26 个字符,0-9 包含 10 个字符。总共 36 个字符足以进行 5 位编码(仅 32 种组合)。
为什么我们不使用 5 位编码而不是八进制或十六进制?
Is there an encoding that uses 5 bits as one group to encode a binary data?
A-Z contain 26 chars and 0-9 contain 10 chars. There are totally 36 chars which are sufficient for a 5-bit encoding (32 combinations only).
Why don't we use a 5-bit encoding instead of Octal or Hexadecimal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如@S.Lott 的评论中提到的,当紧凑性很重要时,base64(6 位)通常用于将二进制数据编码为文本。
出于调试目的(例如十六进制转储),我们使用十六进制,因为字节的大小可以被 4 位整除,因此每个字节都有一个唯一的 2 位十六进制表示,无论其周围有什么其他字节。这使得在查看十六进制转储时很容易“看到”各个字节,并且在 8 位二进制和 2 位十六进制之间进行心理转换也相对容易。 (在 base64 中,字节和编码字符之间没有 1:1 对应关系;同一字节可以根据其位置和其他相邻字节的值生成不同的字符。)
As mentioned in a comment by @S.Lott, base64 (6-bit) is often used for encoding binary data as text when compactness is important.
For debugging purposes (e.g. hex dumps), we use hex because the size of a byte is evenly divisible by 4 bits, so each byte has one unique 2-digit hex representation no matter what other bytes are around it. That makes it easy to "see" the individual bytes when looking at a hex dump, and it's relatively easy to mentally convert between 8-bit binary and 2-digit hex as well. (In base64 there's no 1:1 correspondence between bytes and encoded characters; the same byte can produce different characters depending on its position and the values of other adjacent bytes.)
是的。它是 Base32。也许这个名字是Triacontakaidecimal,但它太长而且很难记住,所以人们简单地称之为base 32。同样,还有用于 6 位组的 Base64
Base32 比十六进制和 base64 的使用要少得多因为与 Base64 相比,它浪费了很多空间,并且与十六进制(可以被 8、16、32 或 64 整除)相比,它使用奇数位数。 6 也是偶数,因此在二进制计算机上比 5 更好
Yes. It's Base32. Maybe the name would be Triacontakaidecimal but it's too long and hard to remember so people simply call it base 32. Similarly there's also Base64 for groups of 6 bits
Base32 is much less common in use than hexadecimal and base64 because it wastes to much space compared to base64, and uses an odd number of bits compared to hexadecimal (which is exactly divisible by 8, 16, 32 or 64). 6 is also an even number, hence will be better than 5 on a binary computer
当然可以,为什么不呢:
Sure, why not: