---
name: "libkeccak_state_create"
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_state_create"
---

# libkeccak\_state\_create(3)

Allocate and initialise hash state

## NAME

libkeccak\_state\_create - Allocate and initialise hash state

## SYNOPSIS

```
#include <libkeccak.h>
struct libkeccak_state *libkeccak_state_create(const struct libkeccak_spec *spec);
```

Link with *-lkeccak*.

## DESCRIPTION

The **libkeccak\_state\_create**() function allocates a new *struct libkeccak\_state \** with one initialised element, and sets the algorithm tuning parameters to those specified by *\*spec*.

## RETURN VALUES

The **libkeccak\_state\_create**() function returns a newly allocated *struct libkeccak\_state \** (of one initialised element) upon successful completion. On error, *NULL* is returned and *errno* is set to describe the error.

## ERRORS

The **libkeccak\_state\_create**() function may fail for any specified for the function [**malloc**(3)](/malloc/3.md).

## SEE ALSO

[**libkeccak\_state\_initialise**(3)](/libkeccak_state_initialise/3.md), [**libkeccak\_state\_free**(3)](/libkeccak_state_free/3.md), [**libkeccak\_state\_fast\_free**(3)](/libkeccak_state_fast_free/3.md) [**libkeccak\_state\_duplicate**(3)](/libkeccak_state_duplicate/3.md)
