KCAPI_MD_SHA1(3)

✨ KCAPI_MD_SHA1 ✨

okay so bestie, welcome to kcapi_md_sha1 from the libkcapi manual, section 3 (that's the library-functions girlies πŸ’…). This is the page for kcapi_md_sha1 β€” SHA-1 message digest on one buffer. One buffer, one shot, one slay. πŸŽ€


🌸 NAME 🌸

kcapi_md_sha1 β€” SHA-1 message digest on one buffer


πŸ¦‹ SYNOPSIS πŸ¦‹

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

πŸ’– ARGUMENTS πŸ’–

  • in β€” [in] buffer with input data. like, the stuff you wanna digest, hand it over 🫢
  • inlen β€” [in] length of input buffer. how many bytes are we working with, bestie
  • out β€” [out] buffer for message digest. this is where the magic lands ✨
  • outlen β€” [in] length of out. the size of the vessel, no cap

πŸ‘‘ DESCRIPTION πŸ‘‘

So with this one-shot convenience function, a message digest of the given buffer is generated. One call, no drama, no state to babysit, we love a low-maintenance icon. πŸ”₯

the output buffer must be allocated by the caller</p> β€” that's you, bestie, you're the main character here β€” and it has to have at least the length of the message digest size for the chosen message digest. if it doesn't… we'll get to that, and it's giving messy 😭

and now the return vibe check:

  • returns the 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
heads up fr fr: on -ENOMEM you don't get nothing, you get a truncated digest dropped into your buffer. not the full thing. don't let it fool you πŸ’€

🌈 AUTHOR 🌈

Stephan Mueller <smueller@chronox.de> β€” Author. (yes the author, periodt πŸ‘‘)


that's the whole page bestie, you're officially fluent in kcapi_md_sha1 now, go digest something πŸ¦‹

libkcapi Manual 1.5.0 Β· July 2025 Β· signing off, mwah πŸ’…

πŸ“¦ where this page comes from