base32::core(n)

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

πŸ’– base32::core β€” bestie edition πŸ’–

ok so this is the base32::core(n) page from the Base32 encoding corner of the manual, and no cap, it's giving ✨internal plumbing✨ energy. let's get into it 🫢


🌸 NAME 🌸

base32::core β€” Expanding basic base32 maps πŸ’… (yes that's literally the name, it's iconic)


✨ SYNOPSIS ✨

package require Tcl 8.5 9

package require base32::core ?0.2?

::base32::core::define map forwvar backwvar ivar

::base32::core::valid string pattern mvar

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so listen. this package hands you the generic commands you need to build full base32 mappings out of a basic mapping β€” and a basic mapping is just a lil list of the codes and the characters they go with πŸŽ€.

the full mappings it creates β€” regular and inverse β€” map to and from bit sequences, and they also deal with the partial mappings hanging out at the end of a string. slay πŸ’…

now the tea: this is essentially an internal package, meant for the people implementing a base32 en- and decoder. a regular user has no need for this package at all, fr fr. it's giving backstage pass only 🎟️


πŸ‘‘ API πŸ‘‘

🧚 ::base32::core::define map forwvar backwvar ivar

this one computes the full forward and backward (inverse) mappings from the basic map, and stashes them in the variables named by forwvar and backwvar respectively 🫢.

it also constructs a regexp pattern for spotting invalid characters in supposedly-base32-encoded input, and drops that into the variable named by ivar ⭐.

πŸ“ ::base32::core::valid string pattern mvar

this one checks whether the input string is a valid base32 encoded string β€” based on the invalid-character pattern that ::base32::core::define generated, plus some other general rules 🌈.

the result is a boolean flag: True if the string is valid, False if it isn't πŸ’€. and when it's False, an error message describing exactly what's wrong with the input gets stored in the variable named by mvar. important: that variable is not touched if the input turned out to be valid πŸ™ˆ.

the rules it checks β€” beyond just rejecting bad characters β€” are:

  1. The length of the input is not a multiple of eight,
  2. The padding appears not at the end of input, but in the middle,
  3. The padding has not of length six, four, three, or one characters,
🫢 heads up bestie, those three rules above are written exactly the way the original says them β€” I'm not about to "fix" the wording and accidentally change the meaning. periodt.

😭 BUGS, IDEAS, FEEDBACK 😭

this document, and the package it describes, will undoubtedly contain bugs and other problems πŸ’€. please report such in the category base32 of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either the package and/or the documentation πŸŽ€.

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

🌈 CATEGORY 🌈

  • Text processing

  • Public domain

ok that's the whole page bestie, you ate πŸ’…βœ¨ this was tcllib version 0.2, dated the way the original footer has it, and that's a wrap β€” go forth and encode responsibly πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from