# What is a definition of a nonce?

Sometimes I read that nonce have to be a random number but imho it's wrong, nonce just should not repeat itself. You could increase in by 1 every time if you are sure it would never repeat.

-
en.wikipedia.org/wiki/Cryptographic_nonce - "In security engineering, nonce is an arbitrary number used only once in a cryptographic communication" –  Henrick Hellström May 30 '13 at 18:41
So defining it as a random number is wrong? Wikipedia is not a source. –  Smit Johnth May 30 '13 at 18:45
In this case Wikipedia is right. Nonce = number used once. It does not have to be generated at random, in fact, generating at random might cause repetitions, with a probability that is a function of the bit length of nonce. –  Henrick Hellström May 30 '13 at 18:55
Is there a real source for that? Our professor has given it as a random number on his lection. –  Smit Johnth May 30 '13 at 19:02
The link on the Wikipedia page is good: cs.ucdavis.edu/~rogaway/papers/nonce.pdf The example in the introduction of that paper is to use a counter as nonce. –  Henrick Hellström May 30 '13 at 19:07

There may be some particular scenarios where an unpredictable nonce is better than just a unique nonce.

For example suppose you have access to an oracle that can generate the correct response to an authentication request that involves a nonce, but you don't have real time access; in particular by the time you get the response from the oracle, the challenge will have expired.

If you can predict what the nonce is going to be (e.g. prev nonce + 1), then you can use the oracle to establish the correct response in advance, then run the protocol against the victim and have the response ready.

An example where this could be realistic is if your challenge-response protocol is cryptographically weak and can be brute-forced, but it takes a long time (e.g. days with the attacker's resources) to do the brute-forcing. An unpredictable nonce would have prevented the vulnerability from being exploitable.

-

Definition 10.9 in Chapter 10 of Handbook of Applied Cryptography.

A nonce is a value used no more than once for the same purpose. It typically serves to prevent (undetectable) replay.

Continuing on, there is some additional info that you might find interesting.

The term nonce is most often used to refer to a “random” number in a challenge-response protocol, but the required randomness properties vary.

-