base32::hex(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– base32::hex β€” the extended hex base32 glow-up πŸ’–

okay so bestie, welcome to base32::hex(3tcl), aka the manual page for the base32 extended hex encoding package in Tcllib. yes it's from Base32 encoding, yes it's a whole mood, and yes we're gonna get through every single line together. grab a boba. πŸ§‹βœ¨


✨ NAME ✨

base32::hex β€” base32 extended hex encoding. that's it, that's the whole name, she's simple and she's iconic. πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require base32::core ?0.2?

package require base32::hex ?0.2?

::base32::hex::encode string

::base32::hex::decode estring

so like, Tcl 8.5 9 is the vibe check, base32::core ?0.2? and base32::hex ?0.2? are the package requirements (that ?0.2? is optional-version energy, not a typo, don't come for me), and then we've got our two commands: ::base32::hex::encode and ::base32::hex::decode. two commands. both slaying. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

This package is literally the whole plug for encoding and decoding strings into and out of the extended hex base32 encoding, exactly as specified in the RFC 3548bis draft. no cap, that's the entire job description. strings go in, encoded strings come out, and vice versa. πŸ”₯


πŸ‘‘ API πŸ‘‘

::base32::hex::encode string

she takes the given string, encodes it in extended hex base32, and hands you back the encoded string as the result. periodt.

and bestie, heads up β€” the result may be padded with the character = to signal a partial encoding at the end of the input string. so if you see a stray = chilling at the end, that's not a glitch, that's her telling you the input got cut off mid-vibe. πŸ’…

::base32::hex::decode estring

this one takes the estring and decodes it, operating on the assumption that it is a valid extended hex base32 encoded string. the decoded result is returned as the command's result. simple. clean. gorgeous. ✨

ngl, there's a little asymmetry here and it's lowkey important: the encoder only ever generates uppercase characters, but this decoder accepts input in lowercase as well. so she's flexible on the way in, strict on the way out. we love a queen with range. πŸŽ€

also β€” the command will always throw an error whenever it runs into conditions that signal some type of bogus input. and the bogus list is exactly this:

  1. the input contains characters which are not valid output of a extended hex 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.

so yeah. bogus input = error, every single time, no mercy, no exceptions, she's not doing charity work. 😭


🌈 CODE MAP 🌈

this is the code map used to convert 5-bit sequences, bestie. numeric id of the bit sequence on the left, the character used to encode it on the right. and the whole ✨important feature✨ of the extended hex mapping is that the first 16 codes map to the digits and hex characters. iykyk.

         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

look at her. 0 through 15 are literally 0–9 and A–F. the hex girls could NEVER. πŸ‘‘


🫢 BUGS, IDEAS, FEEDBACK 🫢

okay real talk for a sec, because this part matters:

This document, and the package it describes, will undoubtedly contain bugs and other problems. (their words, and honestly? respect the honesty. πŸ™ˆ) 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 genuinely want them, bestie.

When proposing code changes, please provide unified diffs, i.e the output of diff -u. that's the love language here.

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. yes, the left-most one. she's the main character button. πŸ’…


πŸ”‘ KEYWORDS πŸ”‘

base32, hex, rfc3548


πŸŽ€ CATEGORY πŸŽ€

Text processing


Public domain. free real estate, go wild, no strings, no cap. 🌈


okay that's the whole page, you ate it, i'm obsessed, go forth and encode πŸ¦‹βœ¨

tcllib Β· version 0.2 Β· base32::hex(3tcl) β€” mwah, love u, bye bestie πŸ’–πŸ’…πŸŽ€

πŸ“¦ where this page comes from