A party that knows the same key can recompute or verify the tag to detect changes and gain assurance that the message came from a key holder. The construction, key, tag length, and protocol rules determine the actual assurance.
MACs are symmetric: every verifier that holds the shared key can also create valid tags. Standard constructions include the keyed-hash message authentication code (HMAC) and cipher-based message authentication code (CMAC). A protocol must specify exactly which bytes and context are authenticated and how a received tag is checked.
Key points
Covered dataAuthenticate the complete security-relevant representation, including identifiers, lengths, versions, algorithms, and context where needed; ambiguous encoding or omitted fields can enable substitution.
Key useGenerate keys securely, limit their distribution, separate them from encryption and unrelated purposes, rotate them under policy, and handle compromise as affecting every holder.
Protocol designUse nonces, sequence numbers, timestamps, or other state when replay or reordering matters, and compare tags without leaking useful timing information.
Important limitationA MAC provides no confidentiality and ordinarily no non-repudiation because any shared-key holder can create a valid tag. It does not prevent replay by itself, and a verified tag says nothing about whether the authenticated content is safe or authorized.