---
name: "libkeccak_state_duplicate"
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_duplicate"
---

# libkeccak\_state\_duplicate(3)

Allocate a duplicate hash state

## NAME

libkeccak\_state\_duplicate - Allocate a duplicate hash state

## SYNOPSIS

```
#include <libkeccak.h>
struct libkeccak_state *libkeccak_state_duplicate(const struct libkeccak_state *src);
```

Link with *-lkeccak*P.

## DESCRIPTION

The **libkeccak\_state\_duplicate**() function allocates a new hash state and initialises it to be identical to *\*src*. This includes all members of the **struct libkeccak\_state** structure, including the state of the sponge and the message chunk buffer.

## RETURN VALUES

The **libkeccak\_state\_duplicate**() 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\_duplicate**() function may fail for any specified for the function [**malloc**(3)](/malloc/3.md).

## SEE ALSO

[**libkeccak\_state\_copy**(3)](/libkeccak_state_copy/3.md), [**libkeccak\_state\_create**(3)](/libkeccak_state_create/3.md)
