Initializerswift-crypto 3.8.0Crypto
init(key:)
Creates a message authentication code generator.
HMAC.swift:59init(key: SymmetricKey)
Parameters
- key
The symmetric key used to secure the computation.
Other members in extension
Typealiases
typealias Key
An alias for the symmetric key type used to compute or verify a message authentication code.
typealias MAC
An alias for a hash-based message authentication code.
Type members
static func authenticationCode<D>(for: D, using: SymmetricKey
) -> MAC Computes a message authentication code for the given data.
static func isValidAuthenticationCode(MAC, authenticating: UnsafeRawBufferPointer, using: 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>(MAC, authenticating: D, using: SymmetricKey
) -> Bool Returns a Boolean value indicating whether the given message authentication code is valid for a block of data.
static func isValidAuthenticationCode<C, D>(C, authenticating: D, using: SymmetricKey
) -> Bool Returns a Boolean value indicating whether the given message authentication code represented as contiguous bytes is valid for a block of data.
Instance members
func finalize(
) -> MAC Finalizes the message authentication computation and returns the computed code.
func update<D>(data: D
) Updates the message authentication code computation with a block of data.