---
name: "libkeccak_unhex"
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_unhex"
---

# libkeccak\_unhex(3)

Converts a hexadecimal hashsum to binary

## NAME

libkeccak\_unhex - Converts a hexadecimal hashsum to binary

## SYNOPSIS

```
#include <libkeccak.h>
void libkeccak_unhex(void *restrict output, const char *restrict hashsum);
```

Link with *-lkeccak*.

## DESCRIPTION

The **libkeccak\_unhex**() function converts a hexadecimal hashsum, stored in *hashsum*, to binary, and stores the binary representation in *output*.

*hashsum* must be terminated by a NUL-character. It may be in either lowercase or uppercase, or a mixture thereof. *output* will not be terminated.

(**strlen**(*hashsum*) / 2) bytes will be written to the beginning of *Ioutput*. It should therefore have an allocation of at least that number of bytes.

## RETURN VALUES

The **libkeccak\_unhex**() function does return any value.

## ERRORS

The **libkeccak\_unhex**() function cannot fail.

## NOTES

*hashsum* must have an even number of digits (characters excluding the terminating NUL-character.)

## SEE ALSO

[**libkeccak\_behex\_lower**(3)](/libkeccak_behex_lower/3.md), [**libkeccak\_behex\_upper**(3)](/libkeccak_behex_upper/3.md)
