---
name: "libkeccak_state_copy"
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_copy"
---

# libkeccak\_state\_copy(3)

Copies hash state

## NAME

libkeccak\_state\_copy - Copies hash state

## SYNOPSIS

```
#include <libkeccak.h>
int libkeccak_state_copy(struct libkeccak_state *dest, const struct libkeccak_state *src);
```

Link with *-lkeccak*.

## DESCRIPTION

The **libkeccak\_state\_copy**() function initialises *\*dest* 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\_copy**() function returns 0 upon successful completion. On error, -1 is returned and *errno* is set to describe the error.

## ERRORS

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

## SEE ALSO

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