<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HMAC/isValidAuthenticationCode(_:authenticating:using:)-5jbc8",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HMACV25isValidAuthenticationCode_14authenticating5usingSbAA06HashedfG0VyxG_SWAA12SymmetricKeyVtFZ"
  },
  "title" : "isValidAuthenticationCode(_:authenticating:using:)"
}
-->

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

```
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

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)