> **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.sha256

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

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.

Backed by `sha256` from [`@noble/hashes`](https://github.com/paulmillr/noble-hashes), an audited & minimal JS hashing library, unless another implementation is installed with [`Engine.set`](https://oxlib.sh/api/Engine/set).

## Imports

```ts
import { Hash } from 'viem/utils'
```

## Examples

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

Hash.sha256('0xdeadbeef')
// '0x5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953'
```

## Definition

```ts
function sha256<value, as>(
  value: value | Hex.Hex | Bytes.Bytes,
  options?: sha256.Options<as>,
): sha256.ReturnType<as>
```

## Parameters

### value

* **Type:** `value | Hex.Hex | Bytes.Bytes`

[`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`Hex.Hex`](/docs/utilities/hex/types#hex) value.

### options

* **Type:** `sha256.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

The return type.

## Return Type

Sha256 hash.

`sha256.ReturnType<as>`
