- Practice
- About 15 min
- 5 practice questions
Tokenisation, encryption and masking: what a breach really exposes
Tell tokenisation from encryption, masking and hashing, and work out what an attacker could use after a breach at a merchant or app.
If something looks wrong, please tell us.
When you save a card in a shopping app, something must be stored so that the next payment is quick. What that something is decides how much harm a data breach can do. Exam questions in this area describe a protection method and ask which term fits, or describe a breach and ask what the attacker can use. This lesson separates four terms that are often blurred: tokenisation, encryption, masking and hashing, explained in general terms.
The four terms
Tokenisation replaces the real card number with a substitute value, the token. The token has no mathematical link to the card number that an outsider could reverse. The link between the two is kept only in a secure system run by a token service provider. A token is usually restricted to one context, such as one merchant or one device, so a token stolen from one merchant is useless at another. Encryption scrambles data with a key so that it can be unscrambled by anyone holding the right key. The original value is still inside the encrypted data. Masking hides part of a value for display, such as showing only the last four digits of a card on a receipt. Hashing turns data into a fixed-length fingerprint that cannot be turned back, which is useful for checking a password without storing it.
The key contrast for exam purposes is between tokenisation and encryption. Encrypted card data can be recovered by anyone who obtains the key. A token cannot be turned back into the card number by the merchant at all, because the merchant never holds the mapping. That is why storing tokens instead of card numbers reduces the damage of a breach at the merchant.
| Method | Is the original value inside? | Typical use |
|---|---|---|
| Tokenisation | No, a substitute replaces it | Saved cards at merchants and on devices |
| Encryption | Yes, recoverable with the key | Protecting data in storage and in transit |
| Masking | Partly, the rest is hidden on display | Receipts, statements, screens |
| Hashing | No, one-way | Checking passwords |
Worked example 1: name the method
A shopping app shows a saved card as 'card ending 4821'. Behind the scenes it holds a 16-digit value issued for that app only, which is different from the card number. Which methods are in use? Working: showing only the last digits is masking, a display choice. The stored 16-digit substitute valid only for that app is a token. Answer: masking for display and tokenisation for storage. Note that the masked digits on screen do not prove tokenisation; the stored substitute does.
Worked example 2: what does the breach expose?
Suppose attackers copy the database of an online store. Store A had kept tokens issued for Store A. Store B, in a separate breach, had kept card numbers encrypted with a key stored on the same server. Which breach is more dangerous to card holders? Working: Store A's tokens work only in Store A's context, and the store holds no mapping back to the card number, so the attackers cannot use them elsewhere. Store B's data contains the real card numbers, and because the key sat on the same server, the attackers can probably decrypt them. Answer: Store B's breach is more dangerous. The lesson is that encryption protects only as well as the key is protected.
A token replaces the card number and is useful only in its own context; encryption hides the card number but keeps it recoverable with the key; masking only hides digits on screen; hashing is one-way.
Common traps
Three traps recur. First, the claim that tokenisation and encryption are the same because both make data unreadable: they differ on whether the original is recoverable from the stored value. Second, the claim that a masked number on a receipt means the merchant does not hold the card: masking is about what is displayed, not what is stored. Third, the claim that a token removes the need for authentication: a token protects stored data, but each payment still has to be authorised by the customer.
Key takeaways: tokenisation swaps the card number for a context-bound substitute whose mapping the merchant never sees; encryption keeps the original and is only as safe as its key; masking is cosmetic; hashing is one-way; and none of these replace the customer's authentication of each payment.
Check your understanding
-
1. Which method replaces a card number with a substitute value that is usable only in a specific context?
- Masking
- Hashing
- Encryption
- Tokenisation
Show answer
Answer: D. A token is a substitute bound to a context such as one merchant or device. Masking hides digits on display, hashing is one-way, and encryption keeps the original recoverable with a key.
-
2. A receipt shows the card number as XXXX XXXX XXXX 3307. This is an example of:
- Tokenisation
- Masking
- Hashing
- Encryption
Show answer
Answer: B. Hiding all but the last digits for display is masking. It says nothing about how the merchant stores the card.
-
3. What is the main difference between encryption and tokenisation?
- Encryption is used only for passwords
- Encrypted data can be turned back into the original with the key; a token cannot be reversed by the merchant
- A token contains the card number in scrambled form
- Encryption makes authentication unnecessary
Show answer
Answer: B. The original value is still inside encrypted data and is recoverable with the key. A token is a substitute whose mapping is held only by the token service provider.
-
4. Attackers steal tokens that a food-delivery app had stored for its customers' cards. What is the most accurate statement?
- The attackers can read every card number directly from the tokens
- The tokens can be used at any other merchant
- The customers' PINs are exposed
- The tokens are of little use outside that app's context
Show answer
Answer: D. Tokens are bound to their context and carry no recoverable card number for the merchant or attacker, which is why tokenisation limits breach damage.
-
5. Which method is best suited to checking a password without storing the password itself?
- Masking
- Tokenisation
- Hashing
- Showing the last four characters
Show answer
Answer: C. Hashing is one-way: the system stores the hash and compares the hash of what the user types, so the password itself is never stored.
Sign in to keep track of the lessons you finish.