---
title: "init(key:)"
framework: cryptokit
role: symbol
role_heading: Initializer
path: "cryptokit/hmac/init(key:)"
---

# init(key:)

Creates a message authentication code generator.

## Declaration

```swift
init(key: SymmetricKey)
```

## Parameters

- `key`: The symmetric key used to secure the computation.

## See Also

### Creating an authentication code iteratively

- [update(data:)](cryptokit/hmac/update(data:).md)
- [finalize()](cryptokit/hmac/finalize().md)
