---
title: "authenticationCode(for:using:)"
framework: cryptokit
role: symbol
role_heading: Type Method
path: "cryptokit/hmac/authenticationcode(for:using:)-heea"
---

# authenticationCode(for:using:)

Computes a message authentication code for the given data.

## Declaration

```swift
static func authenticationCode(for data: RawSpan, using key: SymmetricKey) -> HMAC<H>.MAC
```

## Parameters

- `data`: The data for which to compute the authentication code.
- `key`: The symmetric key used to secure the computation.

## Return Value

Return Value The message authentication code.
