C3 Hash and HMAC
Needs: Supporter
SHA-1 and SHA-2, HMAC, and the difference between a hash, a MAC and a signature.
This is a supporter feature. Create a free account, then try every supporter feature free for 7 days.
What this module covers
You will be able to
- Name SHA-1 and SHA-256 uses in payments
- Compute an HMAC
- Tell a hash from a MAC and a signature
The lesson
- Why it matters
- The concept
- Step by step
- In the real world
- Common mistakes
- What to test
In the module
- The lesson, with diagrams, common mistakes and what to test
- A worked example you can change: Hash and HMAC
- Practice: 3 kinds of generated exercise, each with a step-by-step solution
- A quiz of 8 questions
Key terms
- Collision
- Two different inputs with the same digest. A good hash makes finding one impractical.
- Digest (Hash value)
- The output of a hash function.
- Hash function
- A function that turns any data into a fixed-size digest that changes completely when one bit of the input changes.
- HMAC
- A MAC built from a hash and a secret key. Used in APIs and some tokenisation and key derivation schemes.
- Salt
- Random data added to a value before hashing, so that equal values do not give equal digests. Hashing a PAN without a secret or salt does not protect it.
- SHA-1
- A 160-bit hash, broken for collisions. Still met in older EMV certificates; not for new designs.
- SHA-2
- The family of SHA-224, SHA-256, SHA-384 and SHA-512, the current standard hashes.
The lesson, worked example, practice and quiz open with a supporter pass, which you can try free for 7 days.