KCAPI_MD_HMAC_SHA256(3)
π kcapi_md_hmac_sha256 β the manual page, but make it cute β¨
okay so bestie, welcome to section 3 of the manual (that's the library-calls girlies π
), and today's main character is kcapi_md_hmac_sha256. say it with me: HMAC SHA-256, keyed message digest, one buffer, zero drama. no cap π«Ά
πΈ NAME πΈ
kcapi_md_hmac_sha256 β HMAC SHA-256 keyed message digest on one buffer
likeβ¦ that's it. that's the whole vibe. a keyed message digest, one single buffer, done in one shot. iconic behavior fr fr π₯
β¨ SYNOPSIS β¨
ssize_t kcapi_md_hmac_sha256(const uint8_t * key, uint32_t keylen,
const uint8_t * in, size_t inlen,
uint8_t * out, size_t outlen);
look at her. six arguments. she's giving very "I know what I'm doing" π copy it exactly, don't get creative with the types, the compiler will not be forgiving and neither will I π
π ARGUMENTS π
keyβ [in] the buffer holding your HMAC key. the secret. the sauce. protect her π«Άkeylenβ [in] how long that HMAC key buffer is.uint32_t, so, like, don't go wild.inβ [in] the buffer with your input data. the thing getting digested, bestie.inlenβ [in] length of the input buffer.outβ [out] the buffer where the message digest lands. it's yours to allocate, nobody's doing it for you πoutlenβ [in] length ofout.
π¦ DESCRIPTION π¦
so here's the tea β β this is a one-shot convenience function. one call, one keyed message digest, generated from the buffer you handed over. no init, no update, no final, none of that multi-step situationship. just here's my data, here's my key, gimme the digest β¨
β οΈ important, and I mean this with my whole chest: the output buffer must be allocated by the caller and it has to be at least the length of the message digest size for the chosen keyed message digest. nobody is malloc-ing that for you. that's a you task, bestie π
and now the return value, because she has opinions:
- return size of message digest upon success π slay.
-EIOβ data cannot be obtained π-ENOMEMβ buffer is too small for the complete message digestβ¦ and here's the wild part: the buffer is filled with the truncated message digest. so you get a little half-digest situation. it's giving "partial credit" π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> Author.
the literal author. the icon. the blueprint. we stan π
π COPYRIGHT π
that's the whole page, bestie β go forth and HMAC responsibly π§
libkcapi Manual 1.5.0 Β· July 2025 Β· KCAPI_MD_HMAC_SHA256(3)
periodt. π πΈβ¨
π¦ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms