keyed hash

A hash computed with a secret key mixed in, so only someone who holds the key can produce or check the correct value.

In more detail

A plain, unkeyed hash spots accidental change, but anyone who alters a message can simply recompute it, and anyone can hash every possible value of a short input, such as a card number, to reverse it. Mixing in a key, as HMAC does, blocks both: outsiders cannot produce a matching value or test guesses. The key must be stored away from the hashed data, or the protection is lost.

Example

hmac.new(KEY, msg, "sha256").hexdigest()

Related terms

Taught in

References