HMAC

A hash-based message authentication algorithm.

HMAC.swift:33
iOS
13+
macOS
10.15+
tvOS
13+
watchOS
6+
struct HMAC<H> where H : HashFunction

Use hash-based message authentication to create a code with a value that’s dependent on both a block of data and a symmetric cryptographic key. Another party with access to the data and the same secret key can compute the code again and compare it to the original to detect whether the data changed. This serves a purpose similar to digital signing and verification, but depends on a shared symmetric key instead of public-key cryptography.

As with digital signing, the data isn’t hidden by this process. When you need to encrypt the data as well as authenticate it, use a cipher like AES or ChaChaPoly to put the data into a sealed box (an instance of SealedBox or SealedBox).