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

# TypedData.hashStruct

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

Hashes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) struct.

## Imports

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

## Examples

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

TypedData.hashStruct({
  types: {
    Foo: [
      { name: 'address', type: 'address' },
      { name: 'name', type: 'string' },
      { name: 'foo', type: 'string' }
    ]
  },
  primaryType: 'Foo',
  data: {
    address: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9',
    name: 'jxom',
    foo: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9'
  }
})
// @log: '0x996fb3b6d48c50312d69abdd4c1b6fb02057c85aa86bb8d04c6f023326a168ce'
```

## Definition

```ts
function hashStruct(
  value: hashStruct.Value,
): Hex.Hex
```

## Parameters

### value

* **Type:** `hashStruct.Value`

The Typed Data struct to hash.

#### value.data

* **Type:** `Record`

The Typed Data struct to hash.

#### value.primaryType

* **Type:** `string`

The primary type of the Typed Data struct.

#### value.typeHashes

* **Type:** `Map`
* **Optional**

Optional cache of `keccak256(encodeType(t))` keyed by type name, shared across nested struct/array calls.

#### value.types

* **Type:** `abitype.TypedData`

The types of the Typed Data struct.

## Return Type

The hashed Typed Data struct.

`Hex.Hex`
