---
name: "mdex_tree_hash"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mdex_tree_hash"
---

# mdex\_tree\_hash(3)

create hash of merkle tree root

## NAME

mdex\_tree\_hash - create hash of merkle tree root

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#include <librecast/mdex.h>
```

**int mdex\_tree\_hash(unsigned char** *\*hash***, size\_t** *hashlen***, mtree\_t** *\*mtree***, size\_t** *n***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **mdex\_tree\_hash** function creates a *hash* of length *hashlen* from the root node of *mtree* with key *n*. This is used to index an mtree in several parts, and to distinguish the root node from the first data node when nodes = 1.

## RETURN VALUE

The **mdex\_tree\_hash**() returns zero on success. On error, -1 is returned.

## SEE ALSO

**hash\_generic\_key**(3), [**mdex\_init**(3)](/mdex_init/3.md), [**mdex\_free**(3)](/mdex_free/3.md), [**mdex\_get**(3)](/mdex_get/3.md), [**mdex\_put**(3)](/mdex_put/3.md), [**mdex\_del**(3)](/mdex_del/3.md), [**lc\_share**(3)](/lc_share/3.md)
