> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Function check_membership_with_hasher

Module: `noir_aztec::protocol::merkle_tree::membership`

```rust
pub fn check_membership_with_hasher<let TREE_HEIGHT: u32>(
    leaf: Field,
    membership_witness: MembershipWitness<TREE_HEIGHT>,
    root: Field,
    hasher: fn(Field, Field) -> Field,
) -> bool
```

Check whether a leaf exists in the tree with the given `root`. Same as `check_membership` but uses a custom hasher. `membership_witness` is a hint to prove that the `leaf` exists in the tree with the given `root`.

Returns:

- bool: `true` if the leaf exists in the tree, `false` otherwise.
