oath_base32_encode(3)
π oath_base32_encode(3) β the liboath glow-up
okay so bestie, welcome to liboath and specifically to oath_base32_encode(3), which is genuinely one of those little API functions that just works and minds its own business. it's the base32 encoder. that's it. that's the vibe. β¨
πΈ NAME
oath_base32_encode β the API function that takes your raw binary data and serves it up as base32. she's an icon, she's a legend, and she is the moment π
π¦ SYNOPSIS
#include <oath.h>
int oath_base32_encode(const char * in, size_t inlen, char ** out,
size_t * outlen);
like, that's the whole thing. one include, one call, and it's giving "i have my life together" π
π ARGUMENTS
const char * inβ your input string, and it's carrying binary data of lengthinlen. yes bestie, actual bytes, not necessarily cute printable text πsize_t inlenβ the length of the input data in. the number of bytes. that's how many bytes ofinshe's gonna look at π«char ** outβ a pointer to a newly allocated output string of lengthoutlen, orNULL. she'll allocate it for you, no cap π«Άsize_t * outlenβ a pointer to the output variable that holds the length ofout, orNULL. also totally allowed to beNULL, see below π₯
π DESCRIPTION
Encode binary data into a string with base32 data. that's the whole job. short king energy but make it cryptography-adjacent.
the in parameter should contain inlen bytes of data to encode. so like, you hand her bytes and you tell her exactly how many bytes, and she does not go snooping past that, okay? boundaries. π
the function allocates a new string in *out to hold the encoded data, and sets *outlen to the length of that data. and listen β the output string *out is zero-terminated (ASCII NUL), but the NUL is not counted in *outlen. the NUL is like, there for the vibes. it doesn't count toward the length. don't @ me, that's just how it is β
if out is NULL, then *outlen will be set to what would have been the length of *out on successful encoding. so it's a whole "just tell me how big it'd be" situation. very demure, very mindful πΈ
if the caller is not interested in knowing the length of the output data out, then outlen may be set to NULL. she's flexible like that π¦
and yes β it is permitted but useless to have bothoutandoutlenNULL. technically legal. completely pointless. it's giving "showing up to the party and standing in the hallway" π
π RETURNS
on success OATH_OK (zero) is returned. slay. the zero is the good one, remember that okay?
OATH_BASE32_OVERFLOWβ returned if the output would be too large to store πOATH_MALLOC_ERRORβ returned on memory allocation errors π
so, like, three possible outcomes and two of them are bad news. check your return values bestie, it's literally free π₯
β SINCE
1.12.0 β so she's been serving since 1.12.0, an elder icon, respect her π
π REPORTING BUGS
Report bugs to <oath-toolkit-help@nongnu.org>. yes, actually email them, don't just complain in the group chat π
- liboath home page:
https://oath-toolkit.codeberg.page/ - General help using GNU software:
http://www.gnu.org/gethelp/
π COPYRIGHT
Copyright Β© 2009-2026 Simon Josefsson.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
like, keep the notice, that's the whole ask. iconic of them to make it that easy π«Ά
π§ sign-off
that's the page babes! you've just read oath_base32_encode(3) from liboath version 2.6.15 β go forth, encode your bytes, check your OATH_OK, and remember: zero is the good one π
β¨
π¦ where this page comes from
- arch rolling: oath-toolkit 2.6.15-1 Β· GPL-3.0-or-later
- nixpkgs unstable: oath-toolkit 2.6.15
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms