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

# AesGcm.randomSalt

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

Generates a random salt of the specified size.

## Imports

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

## Examples

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

const salt = AesGcm.randomSalt()
// @log: Uint8Array [123, 79, 183, 167, 163, 136, 136, 16, 168, 126, 13, 165, 170, 166, 136, 136, 16, 168, 126, 13, 165, 170, 166, 136, 136, 16, 168, 126, 13, 165, 170, 166]
```

## Definition

```ts
function randomSalt(
  size?: number,
): Bytes.Bytes
```

## Parameters

### size

* **Type:** `number`
* **Optional**

The size of the salt to generate. Defaults to `32`.

## Return Type

A random salt of the specified size.

`Bytes.Bytes`
