> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Hash Functions

> Standard library hash functions for computing cryptographic hashes

## ripemd160

`ripemd160` computes the Ripemd160 hash of a value.

### Inputs

| Name    | Type                    | Description                   |
| ------- | ----------------------- | ----------------------------- |
| `value` | buffer \| array[buffer] | The hex-encoded value to hash |

### Output

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| `value` | string | The hashed result |

```hcl
output "hashed_data" {
    value = ripemd160(encode_hex("hello, world"))
}
// > hashed_data: 0xa3201f82fca034e46d10cd7b27e174976e241da2
```

---

## sha256

`sha256` computes the sha256 hash of a value.

### Inputs

| Name    | Type                    | Description                   |
| ------- | ----------------------- | ----------------------------- |
| `value` | buffer \| array[buffer] | The hex-encoded value to hash |

### Output

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| `value` | string | The hashed result |

```hcl
output "hashed_data" {
    value = sha256(encode_hex("hello, world"))
}
// > hashed_data: 0x09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b
```

---

## keccak256

`std::keccak256` computes the keccak256 hash of a value.

### Inputs

| Name    | Type   | Description              |
| ------- | ------ | ------------------------ |
| `value` | string | The string value to hash |

### Output

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| `value` | string | The hashed result |

```hcl
output "hashed_data" {
    value = keccak256("hello, world")
}
// > hashed_data: 0x29bf7021020ea89dbd91ef52022b5a654b55ed418c9e7aba71ef3b43a51669f2
```
