scan_base64url(3)
β¨ scan_base64url(3) β the manual, but make it cute β¨
okay bestie, buckle up, because we're decoding base64url and honestly? it's giving main character energy. this one lives in section 3 of the Library Functions Manual, so if you ever need to cite her, she's scan_base64url(3). π
πΈ NAME πΈ
scan_base64url β decode base64url encoded data
π SYNTAX π
#include <libowfat/textcode.h>
size_t scan_base64url(const char *src,char *dest,size_t* destlen);
like, that's the whole vibe. one include, one function, no notes. π«Ά
π DESCRIPTION π
so first of all, what even is base64url? it's a variant of base64 built for URLs, and the tea is this: standard base64 uses / and +, which can cause problems in URLs. so base64url uses - and _ instead. also, base64url does not use = padding at the end. periodt.
scan_base64url decodes base64url encoded data from src into dest. she will stop when she encounters any non-valid input characters β like, she's not gonna fight it, she just stops. then she writes the number of decoded bytes in dest into *destlen, and returns the number of bytes decoded from src. iconic behavior, honestly. β¨
okay so real talk about padding, because this trips people up: many base64 variants demand padding in the last block. some don't. this implementation will consume padding if it is there, but will not complain if it is not. she's chill like that. π
and the flexibility?? bestie:
destcan beNULL.destlencan beNULL.destcan besrc.
yes you read that right, all three. lowkey obsessed. π¦
β RETURN VALUE β
scan_base64url returns the number of bytes successfully scanned and processed from src. that's it, that's the number. no cap. π
π EXAMPLES π
here's the moment you've been waiting for:
scan_base64url("Zm5vcmQ",buf,&i) -> return 7, i=5, buf="fnord"
return 7, i=5, and buf comes out as "fnord". ate. no crumbs. π
π₯ SEE ALSO π₯
and that's the page, bestie π§ this was scan_base64url(3) from the Library Functions Manual, section 3 β go forth and decode responsibly, mwah ππβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms