The toy keyed checksum teaches the check-before-accept concept only.

highlighted = computed this step

Changed bytes would need a different tag

Recomputing over key plus changed message gives tag 0xce22, not the old tag 0xd622.

0xd6220xce220xd622\ne0xce22
Changed message recomputeA changed message would need a different recomputed toy tag.Changed tag compute - computerowindexvalueword00x0f0eword10x7061word20x793dword30x3930raw sum0x000131dcfolded0x31ddresult0xce22

Check before accepting

The concept is simple: authenticated bytes are checked before the receiver accepts the message.

check first=1\text{check first}=1
Changed message recomputeA changed message would need a different recomputed toy tag.Changed tag compute - computerowindexvalueword00x0f0eword10x7061word20x793dword30x3930raw sum0x000131dcfolded0x31ddresult0xce22

What this does not model

NOTE: toy keyed checksum only; not HMAC, not AEAD, not nonce handling, not side-channel safe, and not production authentication.

production MAC=0\text{production MAC}=0
Changed message recomputeA changed message would need a different recomputed toy tag.Changed tag compute - computerowindexvalueword00x0f0eword10x7061word20x793dword30x3930raw sum0x000131dcfolded0x31ddresult0xce22

Summary

A real design uses real authentication, but this toy shows why the changed bytes cannot keep the old tag.

old tag valid for changed message=0\text{old tag valid for changed message}=0
Changed message recomputeA changed message would need a different recomputed toy tag.Changed tag compute - computerowindexvalueword00x0f0eword10x7061word20x793dword30x3930raw sum0x000131dcfolded0x31ddresult0xce22