gnutls_hex2bin(3)
π gnutls_hex2bin(3) π
okay bestie, sit down, hydrate, and let me tell you about this lil function from the gnutls manual. she's giving β¨hex-to-binaryβ¨ and she's honestly so underrated.
πΈ NAME πΈ
gnutls_hex2bin β it's an API function, no cap π
β¨ SYNOPSIS β¨
#include <gnutls/gnutls.h>
int gnutls_hex2bin(const char * hex_data, size_t hex_size, void *
bin_data, size_t * bin_size);
like, that's it. that's the whole vibe. π¦
π ARGUMENTS π
const char * hex_dataβ a string holding your data in hex format. the raw material, the main character, the moment fr.size_t hex_sizeβ how big that hex data is. gotta tell her the size, she's not a mind reader πvoid * bin_dataβ the output array where the binary data lands. your lil container for the glow-up.size_t * bin_sizeβ okay so this one is doing double duty and honestly? iconic. when you call, it should hold the maximum size ofbin_data. on return, it holds the actual length ofbin_data. she reads your intentions, then tells you what actually happened. periodt. π
π DESCRIPTION π
Convert a buffer with hex data to binary data. that's the whole job, and she does it beautifully. π
but here's the tea β: unlike gnutls_hex_decode(), this function can parse hex data that has separators between numbers. that's right β she ignores any non-hex characters. colons, dashes, spaces, whatever weird little punctuation you threw in there? she doesn't even see them. not me being unbothered by your formatting choices π
β¨
so if your hex is all gussied up with separators, this is your girl. gnutls_hex_decode() could never, lowkey.
π«Ά RETURNS π«Ά
GNUTLS_E_SUCCESS on success β slay! π
otherwise, a negative error code. so like, check your return values, bestie, don't just assume it ate. π
π¦ SINCE π¦
2.4.0 β she's been here since 2.4.0, an OG, a legend, a founding mother of the API. π
π REPORTING BUGS π
found a bug? not the vibe, but okay, let's handle it:
Report bugs to <bugs@gnutls.org>.
Home page: https://www.gnutls.org
fr fr, if something's broken, tell the maintainers. they want to know. communication is key in every relationship, including the one between you and your crypto library. π
π 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.
so like, you can copy it, share it, remix it β just keep the copyright notice and this notice with it. give credit where credit is due, always. πΈ
π₯ 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/
like, the whole lore is right there, go read it, iykyk πβ¨
and that's the page, bestie!! this one came from gnutls 3.8.13, and you'll find it filed under gnutls_hex2bin(3) in the manual. mwah π go convert some hex, you gorgeous nerd. π§π
π¦ 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