gnutls_hex_decode(3)
π gnutls_hex_decode(3) β the gnutls girlies' guide π
okay bestie, so this one's from the gnutls manual β yes, that gnutls β and it's a little cutie called gnutls_hex_decode. it does exactly one thing and it does it flawlessly. let's get into it π«Ά
β¨ NAME β¨
gnutls_hex_decode β literally just an API function, that's the whole vibe π
πΈ SYNOPSIS πΈ
#include <gnutls/gnutls.h>
int gnutls_hex_decode(const gnutls_datum_t * hex_data, void * result,
size_t * result_size);
look at her. so demure. so mindful. π
π ARGUMENTS π
const gnutls_datum_t * hex_dataβ this is the encoded data, bestie. the hex-y stuff. the thing you're about to take apart β¨void * resultβ this is where the decoded data gets copied to. her little home πsize_t * result_sizeβ this holds the size of the result. and ngl she's doing double duty, more on that below π
π¦ DESCRIPTION π¦
so here's the tea, okay? this function will decode the given encoded data, using the hex encoding used by PSK password files. that's the specific flavor of hex we're talking about, no substitutions π₯
now the part that trips people up, so pay attention pookie: initially result_size must hold the maximum size available in result. you gotta tell her how much room she's got to work with up front.
and then, on return, result_size will contain the number of bytes written. so she goes in holding a capacity and comes out holding a count. character development, honestly. π
β RETURNS β
GNUTLS_E_SHORT_MEMORY_BUFFERβ the buffer you gave her is not long enough. she's not mad, she's just disappointed πGNUTLS_E_PARSING_ERRORβ the hex data is invalid. it's giving "who wrote this" π0β success!! we love to see it, ate and left no crumbs π
π REPORTING BUGS π
found something cursed? report bugs to <bugs@gnutls.org>. they wanna hear about it fr fr.
home page is right here: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
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. (iconic behavior tbh β free and unbothered πΈ)
π SEE ALSO π
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:
https://www.gnutls.org/manual/
π‘ no cap: read the result_size bit twice. capacity in, byte-count out. that's the whole plot twist and it will get you if you skim. iykyk π
and that's the page, bestie!! π this one shipped with gnutls 3.8.13, dated right there at the bottom next to gnutls_hex_decode(3) β so if you're running that version, you're literally holding the exact manual this was written from. slay. go decode something cute. πβ¨π¦
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms