KCAPI_MD_DIGEST(3)
π kcapi_md_digest β calculate message digest on buffer (one-shot)
okay bestie, welcome to the libkcapi manual, page kcapi_md_digest(3) π
this one's the one-shot digest glow-up β no streaming, no drip-feeding bytes, just one call and boom, hash. let's get into it π«Ά
β¨ SYNOPSIS β¨
ssize_t kcapi_md_digest(struct kcapi_handle * handle,
const uint8_t * in, size_t inlen, uint8_t * out,
size_t outlen);
that's the whole vibe, fr fr πΈ
π ARGUMENTS π
handleβ [in] the cipher handle, your main character πinβ [in] buffer with the input data, aka the stuff you want hashedinlenβ [in] length of the input buffer, tell her how much she's working withoutβ [out] buffer for the message digest β yes it's an out, she gets written into πoutlenβ [in] length ofout
π DESCRIPTION π
so with this one-shot function, a message digest of the given buffer gets generated. literally one call, one digest, no notes π
the output buffer must be allocated by the caller β that's on you, bestie, not on the library π β and it has to have at least the length of the message digest size for whichever message digest you chose. undersized buffer? we'll get to that, and it's giving β¨truncatedβ¨.
the message digest handle must have been initialized, potentially by also setting the key using the generic message digest API functions. no init, no digest, that's the rule π
also the input buffer can be at most INT_MAX in size. that's the ceiling, periodt.
and here's the return tea β:
- return size of message digest upon success π
-EIOβ data cannot be obtained π-ENOMEMβ buffer is too small for the complete message digest, and the buffer is filled with the truncated message digest π
bestie warning fr fr: that-ENOMEMcase isn't just an error, it's also an action. youroutbuffer gets stuffed with a truncated message digest. so you get a partial digest AND an error code. iconic behaviour, honestly. check your sizes before you call this, i am begging π«Ά
π AUTHOR π
- Stephan Mueller
<smueller@chronox.de>- Author.
π COPYRIGHT π
that's the page, bestie!! this was the libkcapi Manual, version 1.5.0, dated July 2025 β kcapi_md_digest(3), no cap. go hash something and slay π
β¨π¦πΈπ
π¦ 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