base32(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ base32(n) β€” the Base32 encoding era ✨

okay bestie, sit down, hydrate, and let me tell you about base32, the Tcl package that encodes and decodes your strings in the standard base32 encoding, exactly like RFC 3548 says. it's giving ✨data integrity✨, it's giving πŸŽ€ lowercase-tolerant decoder energyπŸŽ€, it's lowkey iconic. πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require base32::core ?0.2?

package require base32 ?0.2?

::base32::encode string

::base32::decode estring

like yes, she requires Tcl 8.5 and 9, and she's rocking version 0.2 of both base32::core and base32. the ?0.2? is just the version constraint being cute and optional-ish, iykyk. 🫢


πŸ’– DESCRIPTION πŸ’–

so basically this package hands you the commands for encoding and decoding strings into and out of the standard base32 encoding as specified in RFC 3548. that's it, that's the vibe. encode in, decode out, slay. 🌈


πŸ‘‘ API πŸ‘‘

πŸ’œ ::base32::encode string

this one takes the given string, encodes it in base32, and returns the encoded string as its result. periodt. πŸ’…

and here's the tea: the result may be padded with the character = to signal a partial encoding at the end of the input string. so if the math doesn't line up all nice, she pads it. she's polite like that. ✨

πŸ¦‹ ::base32::decode estring

this command takes the estring and decodes it under the assumption that it's a valid base32 encoded string. the result of the decoding gets returned as the result of the command. easy. πŸ’–

now, important note, bestie: while the encoder will generate only uppercase characters, this decoder accepts input in lowercase as well. she's not picky, she's flexible, she's main character energy. πŸ‘‘

and listen β€” the command will always throw an error whenever it encounters conditions which signal some type of bogus input. namely if:

  1. the input contains characters which are not valid output of a base32 encoder,
  2. the length of the input is not a multiple of eight,
  3. padding appears not at the end of input, but in the middle,
  4. the padding has not of length six, four, three, or one characters,
not me getting emotionally attached to a decoder that actually yells at you when something's wrong 😭 like yes girl, boundaries!

🧚 CODE MAP 🧚

this is the code map used to convert 5-bit sequences. the numeric id of the bit sequences is on the left, and the character used to encode it is on the right. πŸ’«

and here's a fun fact you need to know: the characters "0" and "1" are not used by the encoding. why? because those characters can be easily confused with "O", "o" and "l" (L). not her being considerate about your eyesight 😭 obsessed.

         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

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

ngl, this document, and the package it describes, will undoubtedly contain bugs and other problems. like, they said it themselves, fr fr. πŸ™ˆ

so please report such in the category base32 of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. and please also report any ideas for enhancements you may have for either the package and/or the documentation. they want your thoughts, bestie, they're listening. 🫢

when proposing code changes, please provide unified diffs, i.e the output of diff -u.

note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. like, the left-most one. the very first one. don't overthink it. πŸ’…


🌟 KEYWORDS 🌟

  • base32
  • rfc3548

πŸŽ€ CATEGORY πŸŽ€

Text processing


Public domain


and that's the whole page, bestie!! this was the base32(n) man page from tcllib, version 0.2, and yeah, it's literally all public domain so go wild. mwah, take care of your strings, stay padded at the end only, and never put your padding in the middle. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from