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

# MlDsa44

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

Utilities for working with ML-DSA-44 signatures and key pairs, as defined in [FIPS 204](https://csrc.nist.gov/pubs/fips/204/final).

ML-DSA is a post-quantum digital signature scheme, standardized by NIST as the
primary quantum-resistant replacement for elliptic-curve signatures. The `44`
parameter set targets NIST security category 2 (128-bit classical security).

Private keys are the 32-byte FIPS 204 seed. Public keys are 1,312 bytes and
signatures are 2,420 bytes.

## Examples

Below are some examples demonstrating common usages of the `MlDsa44` module:

* [Creating Key Pairs](#creating-key-pairs)

* [Signing & Verifying](#signing-&-verifying)

### Creating Key Pairs

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

const { privateKey, publicKey } = MlDsa44.createKeyPair()
```

### Signing & Verifying

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

const { privateKey, publicKey } = MlDsa44.createKeyPair()
const payload = '0xdeadbeef'

const signature = MlDsa44.sign({ payload, privateKey })
const isValid = MlDsa44.verify({
  payload,
  publicKey,
  signature
})
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`MlDsa44.createKeyPair`](/docs/utilities/mldsa44/createKeyPair) | Creates a new ML-DSA-44 key pair consisting of a private key and its corresponding public key. |
| [`MlDsa44.fromPrf`](/docs/utilities/mldsa44/fromPrf) | Derives an ML-DSA-44 private key from a 32-byte WebAuthn PRF output. |
| [`MlDsa44.getPublicKey`](/docs/utilities/mldsa44/getPublicKey) | Computes the ML-DSA-44 public key from a provided private key. |
| [`MlDsa44.randomPrivateKey`](/docs/utilities/mldsa44/randomPrivateKey) | Generates a random ML-DSA-44 private key (32-byte seed). |
| [`MlDsa44.sign`](/docs/utilities/mldsa44/sign) | Signs the payload with the provided private key and returns an ML-DSA-44 signature (2,420 bytes). |
| [`MlDsa44.verify`](/docs/utilities/mldsa44/verify) | Verifies a payload was signed by the provided public key. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`MlDsa44.InvalidContextSizeError`](/docs/utilities/mldsa44/errors#mldsa44invalidcontextsizeerror) | Thrown when a context string exceeds the 255-byte FIPS 204 limit. |
| [`MlDsa44.InvalidPrfSizeError`](/docs/utilities/mldsa44/errors#mldsa44invalidprfsizeerror) | Thrown when a WebAuthn PRF output is not 32 bytes. |
