Base32 is a base-32 transfer encoding using the twenty-six letters A-Z and six digits 2-7.
Contents |
Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols which can be conveniently used by humans and processed by old computer systems which only recognize restricted character sets. It comprises a symbol set made up of 32 different characters, as well as an algorithm for encoding arbitrary strings using 8-bit characters into the Base32 alphabet. This uses more than one 5-bit Base32 symbol for each 8-bit input character, and thus also specifies requirements on the allowed lengths of Base32 strings (which must be multiples of 40 bits). The Base64 system, in contrast, is closely related but uses a larger set of 64 symbols.
Base32 has three main advantages over Base64:
Base32 representation takes roughly 20% more space than Base64.
Base64 | Base32 | |
---|---|---|
8-bit | 133% | 160% |
7-bit | 117% | 140% |
The most widely used Base32 alphabet is defined in RFC 4648. It uses an alphabet of A–Z, followed by 2–7. 0 and 1 are skipped due to their similarity with the letters O and I (thus "2" actually has a numerical value of 26).
In some circumstances padding is not required or used. RFC 4648 states that padding MUST be used unless the specification of the standard referring to the RFC explicitly states otherwise. Excluding padding is useful when using base32 encoded data in URL tokens or file names where the padding character could pose a problem.
Value | Symbol | Value | Symbol | Value | Symbol | Value | Symbol | |||
---|---|---|---|---|---|---|---|---|---|---|
0 | A | 9 | J | 18 | S | 27 | 3 | |||
1 | B | 10 | K | 19 | T | 28 | 4 | |||
2 | C | 11 | L | 20 | U | 29 | 5 | |||
3 | D | 12 | M | 21 | V | 30 | 6 | |||
4 | E | 13 | N | 22 | W | 31 | 7 | |||
5 | F | 14 | O | 23 | X | |||||
6 | G | 15 | P | 24 | Y | |||||
7 | H | 16 | Q | 25 | Z | |||||
8 | I | 17 | R | 26 | 2 | pad | = |
z-base-32 is a Base32 encoding designed to be easier for human use and more compact. It includes 8 and 9 but excludes U and 2. It also permutes the alphabet so that the easier characters are the ones that occur more frequently. It compactly encodes bitstrings whose length in bits is not a multiple of 8, and omits trailing padding characters. z-base-32 was used in Mnet open source project, and is currently used in Phil Zimmermann's ZRTP protocol, and in the Tahoe-LAFS open source project.
Another alternative design for Base32 is created by Douglas Crockford, who proposes using additional characters for a checksum.[1] It excludes the letters I, L, and O to avoid confusion with digits. It also excludes the letter U to reduce the likelihood of accidental obscenity.
Value | Encode Digit | Decode Digit | Value | Encode Digit | Decode Digit | |
---|---|---|---|---|---|---|
0 | 0 | 0 o O | 16 | G | g G | |
1 | 1 | 1 i I l L | 17 | H | h H | |
2 | 2 | 2 | 18 | J | j J | |
3 | 3 | 3 | 19 | K | k K | |
4 | 4 | 4 | 20 | M | m M | |
5 | 5 | 5 | 21 | N | n N | |
6 | 6 | 6 | 22 | P | p P | |
7 | 7 | 7 | 23 | Q | q Q | |
8 | 8 | 8 | 24 | R | r R | |
9 | 9 | 9 | 25 | S | s S | |
10 | A | a A | 26 | T | t T | |
11 | B | b B | 27 | V | v V | |
12 | C | c C | 28 | W | w W | |
13 | D | d D | 29 | X | x X | |
14 | E | e E | 30 | Y | y Y | |
15 | F | f F | 31 | Z | z Z |
An earlier form of base 32 notation was used by programmers working on the Electrologica X1 to represent machine addresses. The "digits" were represented as decimal numbers from 0 to 31. For example, 12-16 would represent the machine address 400 (= 12*32 + 16).
Triacontakaidecimal is another alternative design for Base 32, that extends Hexadecimal in a more natural way. RFC 4648 uses base32hex as name for this encoding deployed in RFC 2938.
Unlike many other base 32 notation systems Triacontakaidecimal is contiguous and includes characters that may visually conflict. With the right font it is possible to visually distinguish between 0, O and 1, I. Other fonts are unsuitable because the context that English usually provides is not provided by a notation system that is expressing numbers. However, the choice of font is not controlled by notation or encoding which is why it's risky to assume a distinguishable font will be used.
Value | Symbol | Value | Symbol | Value | Symbol | Value | Symbol | |||
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 9 | 9 | 18 | I | 27 | R | |||
1 | 1 | 10 | A | 19 | J | 28 | S | |||
2 | 2 | 11 | B | 20 | K | 29 | T | |||
3 | 3 | 12 | C | 21 | L | 30 | U | |||
4 | 4 | 13 | D | 22 | M | 31 | V | |||
5 | 5 | 14 | E | 23 | N | |||||
6 | 6 | 15 | F | 24 | O | |||||
7 | 7 | 16 | G | 25 | P | |||||
8 | 8 | 17 | H | 26 | Q | pad | = |
Before NVRAM became universal, several video games for Nintendo platforms used base 32 numbers for passwords. These systems, like Natural Area Code, omit vowels to prevent the game from accidentally giving a profane password. Thus, the characters are generally some minor variation of the following set: 0-9, B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V, W, X, Y, Z, and some punctuation marks. Games known to use such a system include Mario Is Missing!, Mario's Time Machine, Tetris Blast, and The Lord of the Rings (Super NES).
[Chorus]: Master P {Choppa}
Them boys on that block holla (ooh ooh)
Them girls that got it hot holla (ooh ooh)
If ya runnin' from them cops holla (ooh ooh)
{Holla...} (ooh ooh) {Holla} (ooh ooh)
[Verse 1]: Master P
Call me trashman cuz I put it up and back
Whodi owe me money I'ma bust his fuckin' ass
I'm allergic to Dr. Pepper, so pass me Dr. Cristale
Hit me on the two-way, whodi, I get wit'cha
Put it on the stove, bake it like a pie
Take it to the hood, slang it 16-5
When niggas snort it boy, they be passin' it to they girls
Wrap it up in Ziploc, back it up and twirl
Send money to the pent. Mac and C be home soon
Bitches start snitchin' I'ma send 'em to the moon
I could sell a hoe a green, front a hustler a lake
I could never fall off, I'm the "Ghetto Bill" Gates
[Chorus]
[Verse 2]: Curren$y
These lil' niggas can't take it anymore
I push through the club iced out, low key with my P. Miller galore
Hoes breakin' down the doors, uhh
Because the 504 Boyz here they can't wait 'til we get on
It's Curren$y the motherfuckin' rookie of the year
This ain't the WNBA, ain't no pussies over here
Yeah, I'm makin' figures fuckin' with the Ghetto Bill
And a truck with some rims that's bigger than Ferris wheels, holla
[Chorus]
[Verse 3]: Krazy
See this No Limit army nigga, that's my Kliq
The hoe that you tongue kissin' used to be my bitch
For these sayin' they'll slay a nigga, they called pricks
And this brown shit I'm sniffin' nigga, it got me sick
And this big truck I'm pushin', nigga, my tight whip
With a chop of lead on the seat, that'll make you flip
My alias, believe me, Doc Holliday
If it's beef, I'm like AIDS, I'll never go away
[Chorus]
[Verse 4]: Master P
I might be something sly but I won't forget
Tell Double X-L they can, suck my dick
I might be country but I'm ghetto rich
And when it comes to grindin', I started this shit
I put the G in Ghetto, nigga, call me Ghetto Fab
Started with some quarters then I flipped it to some halves
Put the Coke in Coca-Cola, no baking soda
Call me Pistol P, cuz I slang them granola's
[Chorus]
[Verse 5]: T-Bo
I guess them thangs just got dropped off, the block's hot like hot sauce
Some cop cars keep passin' I promise y'all they not lost
Convicted felons noticed when they tryin' to knock ya socks off
Go braggin' to them hatin' bitches, find how much ya watch cost
Loose lips, sank ships, bitch, so watch what you sayin'
It's the New No Limit, baby, got us under surveillance
And the Feds ain't playin' they kickin' down doors daily
Ain't this a bitch, I just got off probation
[Chorus]
[Verse 6]: Magic
I'm tryin' to get me a whole chicken (chop it down for the dimes)
Then flip that bitch quicker than I (flip these rhymes)
Now I'm on two birds I'ma flip (one more time)
And I'ma cop the bitch you left behind
(I'm tryin', I'm hustlin') don't trust me when I'm broke
And I don't discriminate I want the money and a goat
Yeah, better hope I wait, I'm ass out (things will get bloody)
(Four to ya tummy, real messy and ugly)
[Chorus]
[Outro]: Master P
If ya East Coast thuggin, holla (ooh ooh)
If ya West Coast thuggin, holla (ooh ooh)
If ya Midwest thuggin' holla (ooh ooh)
If ya Down South hustlin' holla (ooh ooh)