---
name: "libkeccak_hmac_initialise"
section: "3"
platform: "linux"
package: "libkeccak"
version: "1.4.3-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libkeccak_hmac_initialise"
---

# libkeccak\_hmac\_initialise(3)

Initialise HMAC-hashing state

## NAME

libkeccak\_hmac\_initialise - Initialise HMAC-hashing state

## SYNOPSIS

```
#include <libkeccak.h>
int libkeccak_hmac_initialise(struct libkeccak_hmac_state *state, const struct libkeccak_spec *spec,
                              const void *key, size_t key_length);
```

Link with *-lkeccak*.

## DESCRIPTION

The **libkeccak\_hmac\_initialise**() function initialises *\*state* and sets the algorithm tuning parameters to those specified by *\*spec*, and the key to *key* of length *key\_length*.

## RETURN VALUES

The **libkeccak\_hmac\_initialise**() function returns 0 upon successful completion. On error, -1 is returned and *errno* is set to describe the error.

## ERRORS

The **libkeccak\_hmac\_initialise**() function may fail for any specified for the functions [**malloc**(3)](/malloc/3.md) and [**realloc**(3)](/realloc/3.md).

## SEE ALSO

[**libkeccak\_hmac\_create**(3)](/libkeccak_hmac_create/3.md), [**libkeccak\_hmac\_destroy**(3)](/libkeccak_hmac_destroy/3.md), [**libkeccak\_hmac\_fast\_destroy**(3)](/libkeccak_hmac_fast_destroy/3.md), [**libkeccak\_hmac\_copy**(3)](/libkeccak_hmac_copy/3.md), [**libkeccak\_spec\_cshake**(3)](/libkeccak_spec_cshake/3.md), [**libkeccak\_spec\_sha3**(3)](/libkeccak_spec_sha3/3.md), [**libkeccak\_spec\_shake**(3)](/libkeccak_spec_shake/3.md), [**libkeccak\_spec\_rawshake**(3)](/libkeccak_spec_rawshake/3.md), [**libkeccak\_spec\_check**(3)](/libkeccak_spec_check/3.md), [**libkeccak\_generalised\_spec\_initialise**(3)](/libkeccak_generalised_spec_initialise/3.md), [**libkeccak\_state\_initialise**(3)](/libkeccak_state_initialise/3.md)
