---
title: "isValidAuthenticationCode(_:authenticating:using:)"
framework: cryptokit
role: symbol
role_heading: Type Method
path: "cryptokit/hmac/isvalidauthenticationcode(_:authenticating:using:)-5jbc8"
---

# isValidAuthenticationCode(_:authenticating:using:)

Returns a Boolean value indicating whether the given message authentication code is valid for a block of data stored in a buffer.

## Declaration

```swift
static func isValidAuthenticationCode(_ mac: HMAC<H>.MAC, authenticating bufferPointer: UnsafeRawBufferPointer, using key: SymmetricKey) -> Bool
```

## Parameters

- `mac`: The authentication code to compare.
- `bufferPointer`: A pointer to the block of data to compare.
- `key`: The symmetric key for the authentication code.

## Return Value

Return Value A Boolean value that’s true if the message authentication code is valid for the data within the specified buffer.

## See Also

### Checking an authentication code

- [isValidAuthenticationCode(_:authenticating:using:)](cryptokit/hmac/isvalidauthenticationcode(_:authenticating:using:)-8ezmw.md)
- [isValidAuthenticationCode(_:authenticating:using:)](cryptokit/hmac/isvalidauthenticationcode(_:authenticating:using:)-5ilt9.md)
