gsasl_hex_to(3)

✨ gsasl_hex_to(3) ✨

okay bestie so this is a page from the gsasl manual, and today's main character is gsasl_hex_to. she's an API function. that's it, that's the whole name section, she's literally just built like that πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <gsasl.h>

int gsasl_hex_to(const char * in, size_t inlen, char ** out, size_t *
outlen);

period. that's the whole vibe. four args, one int, no drama. πŸ¦‹


🌸 ARGUMENTS 🌸

  • const char * in β€” the input byte array. the raw material, the ingredients, the before pic. πŸ“
  • size_t inlen β€” how big that input byte array is. she needs to know how much to look at, okay?
  • char ** out β€” a pointer to a newly allocated hex-encoded string. note the word newly allocated, bestie, we're gonna circle back to that, keep it in your notes πŸ“
  • size_t * outlen β€” a pointer to the size of that newly allocated hex-encoded string. she's telling you how long the thing she just made is. iconic behavior, honestly.

πŸ’œ DESCRIPTION πŸ’œ

so. what does she do? she hex encodes data. that's the job. you hand her bytes, she hands you back the hex-encoded version of those bytes. it's giving translator, it's giving glow-up for binary. ✨

couple things you need to know though, no cap:

  • the out string is zero terminated. so it's a proper C string, she's polite like that. 🫢
  • outlen holds the length excluding the terminating zero. so don't go counting that zero, it's not invited to the length party.
  • the out buffer must be deallocated by the caller. hello?? this is the important part!! she mallocs it, you free it. it's not gonna clean up after itself. that's your job now. don't leave her hanging with a memory leak, that's so not the vibe. 😭

Return value: she gives you back GSASL_OK on success. if things go wrong she returns GSASL_MALLOC_ERROR, and that happens if the input was too large or if the memory allocation fail(ed). so if you see GSASL_MALLOC_ERROR, it's not you, it's the malloc. πŸ’€


⭐ SINCE ⭐

1.10 β€” she's been here since 1.10, a true veteran, an OG. bow down. πŸ‘‘


πŸ› REPORTING BUGS πŸ›

found a bug? do NOT suffer in silence, bestie, speak up!! report bugs to:

<bug-gsasl@gnu.org>

and if you want the general guidelines for reporting bugs, they live over at:

https://www.gnu.org/gethelp/

and the GNU SASL home page is right here, pull up:

https://www.gnu.org/software/gsasl/
fr fr, a well-written bug report is a love letter to future maintainers. be specific, be kind. πŸ’–

Copyright Β© 2002-2026 Simon Josefsson.

and the license tea is: 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 go forth, share the file, just keep the receipts. 🧚


πŸ‘€ SEE ALSO πŸ‘€

the full documentation for gsasl is maintained as a Texinfo manual. and if the info and gsasl programs are properly installed at your site, then this command:

info gsasl

should give you access to the complete manual. yes ma'am, that's the whole lore in one command. πŸ¦‹

as an alternative, you may obtain the manual from:

https://www.gnu.org/software/libidn/gsasl/manual/

and that's the page!! anyway, this was gsasl_hex_to(3) from the gsasl manual, source/version 2.2.4, dated gsasl_hex_to(3)-era... wait no, the footer is gsasl 2.2.4 and gsasl_hex_to(3). mwah. free your buffers. love you, byeee πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from