KCAPI_MD_SM3(3)

✨ KCAPI_MD_SM3 ✨

okay bestie, welcome to the KCAPI_MD_SM3(3) page β€” this is the one that does SM3 message digest on one buffer and honestly? it's giving one-shot convenience realness πŸ’… no cap.


πŸŽ€ SYNOPSIS πŸŽ€

ssize_t kcapi_md_sm3(const uint8_t * in, size_t inlen, uint8_t * out,
                     size_t outlen);

like, that's the whole thing. one call, one buffer in, digest out. periodt. 🌸


🌈 ARGUMENTS 🌈

  • in β€” [in] the buffer with your input data. this is the stuff you're hashing, the main character fr.
  • inlen β€” [in] length of the input buffer. tell her how much data she's working with, she can't read minds πŸ™ˆ
  • out β€” [out] the buffer for the message digest. this is where the glow-up lands ✨
  • outlen β€” [in] length of out. yes you gotta declare it, that's just the vibe check.

πŸ’– DESCRIPTION πŸ’–

so with this one-shot convenience function, a message digest of the given buffer gets generated. that's it, that's the job. no state to babysit, no multi-step saga, just in and out and slay. πŸ¦‹

the way that the output buffer must be allocated by the caller β€” yeah, that's on you, bestie, she's not mallocing for you β€” and it needs to have at least the length of the message digest size for the chosen message digest. so if your out is too smol for the digest, we got a situation (see below πŸ‘€).

and it returns:

  • size of message digest upon success πŸŽ‰ β€” iconic, no notes
  • -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
okay real talk on that last one: -ENOMEM doesn't mean nothing happened. it means you got a truncated digest dropped into your buffer. so like… read the return value, don't just assume. fr fr. πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

  • Stephan Mueller <smueller@chronox.de> β€” Author.

the literal author. the blueprint. we stan. 🫢


copyright info lives down here at the bottom where it belongs, quiet and iconic.


and that's the page, bestie!! 🌈✨ you just read libkcapi Manual 1.5.0, dated July 2025, filed under KCAPI_MD_SM3(3). go hash something cute. mwah πŸ’–πŸŽ€πŸ§š

πŸ“¦ where this page comes from