base32::hex(n)

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

✨ base32::hex(n) β€” the manual page, but make it make sense ✨

okay bestie, gather round πŸ’– this is the manpage for base32::hex, and it's from the Base32 encoding corner of the tcllib universe. she's giving very specific, very nerdy, very useful πŸŽ€


🌸 NAME 🌸

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


🌈 SYNOPSIS 🌈

the way you summon her:

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

no cap, that's the whole ritual 🫢


πŸ’œ DESCRIPTION πŸ’œ

so this package hands you the commands to encode and decode strings into and out of the extended hex base32 encoding, exactly as specified in the RFC 3548bis draft. she's standards-compliant and she knows it ✨


πŸ‘‘ API πŸ‘‘

πŸ¦‹ ::base32::hex::encode string

this one takes the given string, encodes it in extended hex base32, and returns the encoded string as its result. and listen β€” the result may be padded with the character = to signal a partial encoding at the end of the input string. so don't be shocked when you see an = chilling at the end, that's just her being honest about where the input stopped 🌸

πŸ¦‹ ::base32::hex::decode estring

this command takes the estring and decodes it, operating under the assumption that it's a valid extended hex base32 encoded string. the decoded result is returned as the result of the command. πŸ’«

ngl, one cute detail: while the encoder will generate only uppercase characters, this decoder accepts input in lowercase as well. she's flexible like that πŸ’…

⚠️ but fr fr, the command will always throw an error whenever it hits conditions that signal some type of bogus input, namely if:
  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, she does not play about malformed input 😭


⭐ CODE MAP ⭐

this is the code map used to convert 5-bit sequences β€” numeric id of the bit sequence on the left, the character used to encode it on the right. and the important feature of the extended hex mapping? the first 16 codes map to the digits and hex characters. iconic behavior honestly πŸ”₯

         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

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

okay so real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. no shame in it, it's just facts πŸ™ˆ 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 β€” she wants to hear from you 🫢

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. ✨


πŸ“ KEYWORDS πŸ“

base32, hex, rfc3548


🧚 CATEGORY 🧚

Text processing


Public domain β€” she's free, she's generous, she belongs to everyone πŸ‘‘


and that's the whole page, bestie πŸŽ€ this is base32::hex(n) from tcllib, version 0.2, dated 0.2 β€” go forth and encode responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from