oath_hex2bin(3)
π
oath_hex2bin(3) β like, the liboath glow-up page π
okay so bestie, you're looking at oath_hex2bin, a function from the liboath manual, section 3. that's the whole vibe. let's get into it β¨
πΈ SYNOPSIS πΈ
like, here's the whole thing, copy it exactly or it won't compile, no cap:
#include <oath.h>
int oath_hex2bin(const char * hexstr, char * binstr, size_t * binlen);
three arguments, one int back. she's simple, she's iconic. π
π¦ ARGUMENTS π¦
const char * hexstrβ the input string, and it's carrying hex data. that's her whole personality. πchar * binstrβ the output string that holds the binary data. orNULL! she can absolutely beNULL, it's giving mysterious. πsize_t * binlenβ an output variable holding the needed length ofbinstr. so she tells you how much room you actually need. queen behavior. π
β¨ DESCRIPTION β¨
so the entire job is: convert a string with hex data into binary data. literally that's it. hex in, binary out. π§
now listen, and this is the important part β non-hexadecimal data are not ignored. she does not let that slide. instead they will lead to an OATH_INVALID_HEX error. no silent skipping, no "close enough", she will absolutely call you out. π
here's the part where binlen is doing main character energy:
- if
binstrisNULL, thenbinlenwill be populated with the necessary length. so you can ask "how big does this need to be" before you commit. obsessed. π«Ά - if the
binstrbuffer is too small,OATH_TOO_SMALL_BUFFERis returned, andbinlenwill contain the necessary length. she's not gonna write half and leave you guessing β she tells you the size you need. slay. π
π₯ RETURNS π₯
on success, OATH_OK (zero) is returned. otherwise an error code is returned. that's the whole contract, bestie. zero = we ate. nonzero = read the code and cry a little. π
π REPORTING BUGS π
found a bug? don't suffer in silence, tell the group chat:
report bugs to <oath-toolkit-help@nongnu.org>.
also for your bookmarks:
liboathhome 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. so like, go forth and share it, just keep the receipts. π
and that's the page!! this was oath_hex2bin(3) from liboath, version 2.6.15 β periodt. βπ¦π
π¦ 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