base32::hex(n)
β¨ 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:
- the input contains characters which are not valid output of a extended hex base32 encoder,
- the length of the input is not a multiple of eight,
- padding appears not at the end of input, but in the middle,
- 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
π COPYRIGHT π
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
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms