什么是base32编码?

发布于 2024-10-22 04:36:06 字数 275 浏览 10 评论 0原文

关于如何实现base32编码或base32编码的规范有足够的信息,但我不明白它是什么,为什么我们需要它以及主要应用程序在哪里。有人可以解释一下并提供有关使用的真实生活场景吗?谢谢。

crockford base32 维基百科 base32

There is enough information on how to implement base32 encoding or the specification of base32 encoding but I don't understand what it is, why we need it and where are the primary applications. Can someone please explain and give nice real life scenarios on usage? Thanks.

crockford base32
wikipedia base32

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

紅太極 2024-10-29 04:36:06

与任何其他“仅 ASCII”编码一样,base32 的主要目的是确保其编码的数据能够通过系统或协议进行传输,这些系统或协议对其接受的字符范围有特殊限制,并且未修改

例如,b32 编码的数据可以传递到接受单字节字符输入或 UTF-8 编码字符串输入的系统,或附加到 URL,或添加到 HTML 内容,而不会被破坏或导致无效形式。使用 Base64(更为常见)的原因完全相同。

b32 相对于 b64 的主要优点是它更易于人类阅读。这并不是什么优势,因为数据通常由计算机处理,因此 b32 与 b64 相比相对稀有(在空间方面效率更高)。

更新:这里有关于 Base64 的相同问题:Base 64 编码用于什么?

Like any other "ASCII-only" encoding, base32's primary purpose is to make sure that the data it encodes will survive transportation through systems or protocols which have special restrictions on the range of characters they will accept and emerge unmodified.

For example, b32-encoded data can be passed to a system that accepts single-byte character input, or UTF-8 encoded string input, or appended to a URL, or added to HTML content, without being mangled or resulting in an invalid form. Base64 (which is much more common) is used for the exact same reasons.

The main advantage of b32 over b64 is that it is much more human-readable. That's not much of an advantage because the data will typically be processed by computers, hence the relative rarity of b32 versus b64 (which is more efficient space-wise).

Update: there's the same question asked about Base64 here: What is base 64 encoding used for?

又爬满兰若 2024-10-29 04:36:06

Base32 编码(和 Base64)编码的动机是,您需要在存储或传输系统中对不受限制的二进制进行编码,而该系统仅允许某种形式的数据(例如纯文本)。示例包括通过 URL、XML 或 JSON 数据传递数据,所有这些都是纯文本格式,否则不允许或支持任意二进制数据。

Base32 encoding (and Base64) encoding is motivated by situations where you need to encode unrestricted binary within a storage or transport system that allow only data of a certain form such as plain text. Examples include passing data through URLs, XML, or JSON data, all of which are plain text sort of formats that don't otherwise permit or support arbitrary binary data.

椒妓 2024-10-29 04:36:06

除了之前关于数字中的 Base32 与 Base64 的答案之外。对于相同的 .pdf 文件编码结果为:

base64.base32encode(content) = 190400 个符号

base64.base64encode(content) = 158668 个符号

In addition to previous answers for base32 vs base64 in numbers. For same .pdf file encoded result is:

base64.base32encode(content) = 190400 symbols

base64.base64encode(content) = 158668 symbols

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文