LIBKECCAK_...AST_DIGEST(3)

πŸ“¦ version 1.4.3, in arch rolling, opensuse-leap 16.0

πŸ’– NAME πŸ’–

libkeccak_hmac_fast_digest β€” Complete the HMAC-hashing of a message without erasure.

okay bestie, welcome to the LIBKECCAK Library Functions Manual page for this icon. It’s the fast digest finish-line function, and yes, we’re keeping every deet. ✨

✨ SYNOPSIS ✨

#include <libkeccak.h>

int libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *state, const void *msg, size_t msglen,
                               size_t bits, const char *suffix, void *hashsum);

Link with -lkeccak.

πŸ¦‹ DESCRIPTION πŸ¦‹

The libkeccak_hmac_fast_digest() function absorbs the last part of (or all of) a message, and returns the HMAC hash of the entire message. Slay. πŸ’…

Here’s the parameter tea:

  • msg β€” the last part of the message. If all of the message has already been processed by calls to libkeccak_hmac_update(3) or libkeccak_hmac_fast_update(3) (with the same pointer on state,), then msg and msglen should be set to NULL and 0, respectively.
  • msglen β€” the byte-size of the message part in msg. It must only count the number of whole bytes, that is, the floor of the number of bits in the message divided by 8.
  • bits β€” if the message is not comprised of a whole number of bytes, put the number of bits, modulus 8, in this parameter.
  • suffix β€” a NUL-terminated string of ASCII '1':s and '0':s, representing the bits that should be appended to the message. If this string is empty, NULL may be used instead. This is used to select the hash algorithm. For pure Keccak, NULL or "" is used. For the other algorithms the constants LIBKECCAK_SHA3_SUFFIX (for SHA-3), LIBKECCAK_RAWSHAKE_SUFFIX (for RawSHAKE), and LIBKECCAK_SHAKE_SUFFIX (for SHAKE) are used.
  • hashsum β€” where the hash of the message will be stored, unless hashsum is NULL (which increases the performance of the call.) A total of ((state->n + 7) / 8) bytes will be written to the beginning of hashsum. Therefore, hashsum needs at least an allocation size of that number of bytes.
⚠️ heads up, bestie: libkeccak_hmac_fast_digest() may reallocate the state’s message chunk buffer. When doing so, it attempts to do so as quickly as possible, rather than ensuring that the information in the old allocation is securely removed if a new allocation is required. Not the secure-wipe vibe β€” that’s just the documented behavior. πŸ’€

πŸŽ€ RETURN VALUES πŸŽ€

The libkeccak_hmac_fast_digest() function returns 0 upon successful completion. On error, -1 is returned and errno is set to describe the error. 🫢

🌸 ERRORS 🌸

The libkeccak_hmac_fast_digest() function may fail for any reason specified by the function realloc(3). 😭

πŸ”₯ SEE ALSO πŸ”₯


source/version: LIBKECCAK Β· footer title repeat: LIBKECCAK_...AST_DIGEST(3) Β· date: not printed on this page, bestie β€” mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from