Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is base32 encoding?

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

like image 428
Jeff Avatar asked Mar 14 '11 01:03

Jeff


People also ask

What is the difference between Base32 and Base64?

Crockford's base 32 encoding It is more efficient than hexadecimal, representing 25% more bits per character. It's less efficient than base 64, representing 17% fewer bits per character, but is more legible than base 64 encoding because it eliminates commonly confused characters. His encoding is also case insensitive.

What characters are in Base32?

It uses an alphabet of A–Z, followed by 2–7. The digits 0, 1 and 8 are skipped due to their similarity with the letters O, I and B (thus "2" has a decimal value of 26).

What is Base32 decryption?

Base32 is a transfer encoding using a 32-character set, which can be beneficial when dealing with case-insensitive filesystems, spoken language or human memory.

How does Base64 encode work?

How does base64 work? Base64 encoding converts every three bytes of data (three bytes is 3*8=24 bits) into four base64 characters. Which makes up a total of three bytes (24 bits). Base64 encoding will divide the binary data up to six-bit chunks and map them to a base64 character according to the table above.


3 Answers

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

like image 137
valex Avatar answered Feb 23 '23 03:02

valex


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?

like image 35
Jon Avatar answered Feb 23 '23 05:02

Jon


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.

like image 41
DuckMaestro Avatar answered Feb 23 '23 05:02

DuckMaestro