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 π§ββοΈπΈ
π¦ where this page comes from
- arch rolling: audit 4.2.1-1 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 10: audit-libs-devel 4.2.1-3.el10 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- nixpkgs unstable: audit 4.2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms