AUDIT_ENCODE_VALUE(3)

✨ AUDIT_ENCODE_VALUE(3) ✨

okay bestie, welcome to the Linux Audit API corner of the man pages πŸ’… this one is genuinely so cute and so simple, let me put you on 🫢


🌸 NAME 🌸

audit_encode_value β€” turn your raw bytes into an uppercase ASCII hex string, no cap ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <libaudit.h>

char *audit_encode_value(char *final, const char *buf, unsigned int size);

πŸ’– DESCRIPTION πŸ’–

so audit_encode_value() takes size bytes from buf and encodes them as an uppercase ASCII hexadecimal string πŸ¦‹ every single input byte gets written out as two hex digits. periodt.

and here's the part that's giving main character energy: the input does not have to be NUL-terminated, and it is totally allowed to contain embedded NUL bytes πŸ™ˆ so you can yeet whatever raw binary you want at it and it will not choke.

final is the output buffer that you, the caller, have to provide πŸ’… it has to be at least 2 * size + 1 bytes long β€” that's room for the encoded value plus its terminating NUL byte. don't forget the + 1, I'm begging 😭

size is the number of bytes to encode from buf β€” it is not necessarily the result of strlen(3), okay? don't come for me with strlen, that's literally not the vibe here.

if buf is NULL, audit_encode_value() just writes an empty string to final. graceful. iconic. ✨

e.g.:

  • "foo bar" gets encoded as "666F6F20626172"
  • "\1\2\3\4" gets encoded as "01020304"

πŸ‘‘ RETURN VALUE πŸ‘‘

returns final on success πŸŽ‰ if final is NULL, then NULL is what you get back. that's it, that's the whole deal.


🌈 SEE ALSO 🌈


πŸ“ AUTHOR πŸ“

Steve Grubb β€” thank you king 🫢


this page came to you courtesy of Red Hat, May 2026 πŸ’œ and that's the whole AUDIT_ENCODE_VALUE(3) moment, bestie β€” go encode something cute πŸ§šβ€β™€οΈπŸŒΈ