MAC algorithms can be constructed from other cryptographic primitives, like
cryptographic hash functions (as in the case of
HMAC) or from
block cipher algorithms (
OMAC,
CCM,
GCM, and
PMAC). However many of the fastest MAC algorithms, like
UMAC-
VMAC and
Poly1305-AES, are constructed based on
universal hashing. Intrinsically keyed hash algorithms such as
SipHash are also by definition MACs; they can be even faster than universal-hashing based MACs. Additionally, the MAC algorithm can deliberately combine two or more cryptographic primitives, so as to maintain protection even if one of them is later found to be vulnerable. For instance, in
Transport Layer Security (TLS) versions before 1.2, the
input data is split in halves that are each processed with a different hashing primitive (
SHA-1 and
SHA-2) then
XORed together to output the MAC.
One-time MAC Universal hashing and in particular
pairwise independent hash functions provide a secure message authentication code as long as the key is used at most once. This can be seen as the
one-time pad for authentication. The simplest such pairwise independent hash function is defined by the random key, , and the MAC tag for a message
m is computed as , where
p is prime. More generally,
k-independent hashing functions provide a secure message authentication code as long as the key is used less than
k times for
k-ways independent hashing functions. Message authentication codes and data origin authentication have been also discussed in the framework of
quantum cryptography. By contrast to other cryptographic tasks, such as key distribution, for a rather broad class of quantum MACs it has been shown that quantum resources do not offer any advantage over unconditionally secure one-time classical MACs. ==Standards==