> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Hash

:::info
`Hash` is a re-export of ox's [`Hash`](https://oxlib.sh/api/Hash). Refer to the ox documentation for the full reference.
:::

Utility functions for hashing (keccak256, sha256, etc).

## Examples

```ts twoslash
// @noErrors
import { Hash } from 'viem/utils'

const value = Hash.keccak256('0xdeadbeef')
// '0xd4fd4e189132273036449fc9e11198c739161b4c0116a9a2dccdfa1c492006f1'
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Hash.blake3`](/docs/utilities/hash/blake3) | Calculates the [BLAKE3](https://github.com/BLAKE3-team/BLAKE3) hash of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value. |
| [`Hash.createBlake3`](/docs/utilities/hash/createBlake3) | Creates an incremental BLAKE3 hasher. |
| [`Hash.createHmac256`](/docs/utilities/hash/createHmac256) | Creates an incremental HMAC-SHA256 hasher. |
| [`Hash.createKeccak256`](/docs/utilities/hash/createKeccak256) | Creates an incremental Keccak256 hasher. |
| [`Hash.createRipemd160`](/docs/utilities/hash/createRipemd160) | Creates an incremental RIPEMD-160 hasher. |
| [`Hash.createSha256`](/docs/utilities/hash/createSha256) | Creates an incremental SHA-256 hasher. |
| [`Hash.hmac256`](/docs/utilities/hash/hmac256) | Calculates the [HMAC-SHA256](https://en.wikipedia.org/wiki/HMAC) of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value. |
| [`Hash.keccak256`](/docs/utilities/hash/keccak256) | Calculates the [Keccak256](https://en.wikipedia.org/wiki/SHA-3) hash of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value. |
| [`Hash.ripemd160`](/docs/utilities/hash/ripemd160) | Calculates the [Ripemd160](https://en.wikipedia.org/wiki/RIPEMD) hash of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value. |
| [`Hash.sha256`](/docs/utilities/hash/sha256) | Calculates the [Sha256](https://en.wikipedia.org/wiki/SHA-256) hash of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value. |
| [`Hash.validate`](/docs/utilities/hash/validate) | Checks if a string is a valid hash value. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Hash.HasherDestroyedError`](/docs/utilities/hash/errors#hashhasherdestroyederror) | Thrown when an incremental hash state has been consumed or destroyed. |
| [`Hash.InvalidDigestSizeError`](/docs/utilities/hash/errors#hashinvaliddigestsizeerror) | Thrown when a digest output buffer is too small. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Hash.Hasher`](/docs/utilities/hash/types#hashhasher) | Incremental hash state. |
