# TypedData.hashStruct

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

## Imports

:::code-group
```ts [Named]
import { TypedData } from 'ox'
```

```ts [Entrypoint]
import * as TypedData from 'ox/TypedData'
```
:::

## Examples

```ts twoslash
import { TypedData } from 'ox'

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
```

**Source:** [src/core/TypedData.ts](https://github.com/wevm/ox/blob/main/src/core/TypedData.ts#L1040)

## 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`
