KCAPI_MD_SHA256(3)
π NAME π
kcapi_md_sha256 β SHA-256 message digest on one buffer β¨
okay so bestie, this is a one-shot situation, meaning you hand it a buffer, it hands you back the SHA-256 digest, and nobody has to talk about streaming state or whatever. it's giving "get in, hash, get out" π
(also, the manual page is KCAPI_MD_SHA256(3), in case you were wondering which page you landed on π)
πΈ SYNOPSIS πΈ
ssize_t kcapi_md_sha256(const uint8_t * in, size_t inlen, uint8_t * out,
size_t outlen);
like, that's the whole vibe. four arguments, one digest, no cap π₯
β¨ ARGUMENTS β¨
inβ [in] the buffer with your input data, aka the thing you want digested πinlenβ [in] how long that input buffer is, fr froutβ [out] the buffer where the message digest lands πoutlenβ [in] length ofout, so it knows how much room it's working with
π¦ DESCRIPTION π¦
With this one-shot convenience function, a message digest of the given buffer is generated. that's it, that's the function, iconic behaviour honestly β¨
heads up bestie: the output buffer must be allocated by the caller and have at least the length of the message digest size for the chosen message digest. we do not allocate it for you. you got this, but like, actually allocate it π
and here's the tea on what it hands back β:
- 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 π
not me warning you again: that -ENOMEM case still writes to your buffer β just a truncated digest. so don't go treating a partial digest like a full one, okay? read the return value, always π«Ά
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. shoutout to the main character who wrote this π
π COPYRIGHT π
libkcapi Manual 1.5.0, July 2025 β that's the version and the date, periodt. take care of yourself and hydrate before you hash ππ§πΈ
π¦ 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