MAC
An alias for a hash-based message authentication code.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
typealias MAC = HashedAuthenticationCode<H>
An alias for a hash-based message authentication code.
typealias MAC = HashedAuthenticationCode<H>
import Crypto
A cryptography library for Swift.
struct HMAC<H> where H : HashFunction
A hash-based message authentication algorithm.
struct HashedAuthenticationCode<H> where H : HashFunction
A hash-based message authentication code.
init(key: SymmetricKey)
Creates a message authentication code generator.
static func authenticationCode<D>(for data: D, using key: SymmetricKey) -> MAC where D : DataProtocol
Computes a message authentication code for the given data.
static func isValidAuthenticationCode(_ mac: MAC, authenticating bufferPointer: UnsafeRawBufferPointer, using key: SymmetricKey) -> Bool
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<D>(_ authenticationCode: MAC, authenticating authenticatedData: D, using key: SymmetricKey) -> Bool where D : DataProtocol
Returns a Boolean value indicating whether the given message authentication code is valid for a block of data.
static func isValidAuthenticationCode<C, D>(_ authenticationCode: C, authenticating authenticatedData: D, using key: SymmetricKey) -> Bool where C : ContiguousBytes, D : DataProtocol
Returns a Boolean value indicating whether the given message authentication code represented as contiguous bytes is valid for a block of data.
func finalize() -> MAC
Finalizes the message authentication computation and returns the computed code.
mutating func update<D>(data: D) where D : DataProtocol
Updates the message authentication code computation with a block of data.
typealias Key = SymmetricKey
An alias for the symmetric key type used to compute or verify a message authentication code.