Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When a hardware system is protected by a 4 digits password, what is the advantage of the attacker into breaking that system?

Isn't it $10*10*10*10=10^{4}$? If $\frac{1}{10^{4}}$ is the cost of such an attack then is this reasonable computation for the attacker? In my eyes this seems like a simple brute force attack for 4 numbers. I mean is super easy. Isn't it?

share|improve this question
up vote 0 down vote accepted

When a 4-digit PIN is used, it is customary that something limits to only 3 consecutive false PINs (that is typically enforced by the card itself on a Smart Card, or by some central system on modern ATMs). Hence odds of finding the right PIN are $3/{10^4}$ or 0.03% if the adversary tries three distinct random PINs.

share|improve this answer
This is however not the advantage. It is basically the success probability of an online dictionary attack. (The dictionary being the set of all four digit numbers.) – Maeher Jun 27 '12 at 10:36
@Maeher: Agreed, but advantage supposes a reference to compare to, is not it? And here I fail to find a reference. Or is there some definition of advantage that I am missing? – fgrieu Jun 27 '12 at 11:04

Something went wrong with you calculations there :) A single digit has $10$ possible values, not $2^{10}$. What you were probably trying to calculate was $\frac{1}{10^4}=\frac{1}{10000}$.

It is a bit unclear what you mean by advantage. In cryptography, the advantage $\mathsf{Adv}_\mathcal{A}$ of an adversary $\mathcal{A}$ is the probability that $\mathcal{A}$ is successful ($\mathsf{Succ}_\mathcal{A}$) in attacking something minus the success probability for some trivial attack that cannot be prevented.

For example, for a decision problem, such as CPA security, the advantage is $\mathsf{Adv}_\mathcal{A}=\mathsf{Succ}_\mathcal{A}-\frac{1}{2}$. This is because you acannot prevent $\mathcal{A}$ from guessing the bit.

The advantage of guessing a four digit PIN with one random guess is $1/10^4$. For at most $t$ random (but distinct) guesses, we get $\frac{t}{10^4}$. The advantage for an adversary attacking some authentication service using four digit PINs would therefore usually be $\mathsf{Adv}_\mathcal{A}=\mathsf{Succ}_\mathcal{A}-\frac{t}{10^4}$.

EDIT: In the first version of this answer I assumed that PINs would be chosen uniformly for each try. Of course that's not true. They would indeed be chosen to be distinct from each other. (This makes the probabilities quite a bit easier.)

share|improve this answer
Yes you are right about the calculations. I was a bit confused. I corrected the question – curious Jun 27 '12 at 10:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.