Definition
Nonce §5.18 collision probability is the probability that two independent random draws of a nonce, a value meant to be used only once, coincide. By the birthday bound §5.6, repeats become likely once the number of draws nears the square root of the number of possible values. Replay freshness is the property that a receiver acts on each authenticated message at most once, even if an attacker resends the message. A collision is an accident of honest draws; a replay is a deliberate copy, which repeats the nonce with certainty.
Where it fits
The Nonce entry explains how nonces are produced and why some algorithms §14.1 fail when one repeats. If a sender draws nonces independently and uniformly (each value equally likely) from the possible -bit values, the probability that some two of them are equal is at most : the number of pairs, , times the probability that one pair matches. For and , about one million messages, the bound is . For and messages, it is about 0.5. This number says how likely two honest messages are to share a nonce, and nothing more.
Freshness asks a different question, the one the Replay attack §1.26 entry treats. A sender draws the nonce 0x5e2a91c7, places it in an unlock command and computes an authentication §1.6 tag over the whole command: a short value that only a holder of the secret key can compute. An attacker records the command with its tag and sends the same bytes an hour later. No second draw took place, so the collision probability plays no part: the nonce repeats with probability 1, because the attacker copied it. The tag still verifies, because the bytes are exactly the ones the key holder authenticated, and a receiver that checks only the tag executes the command twice. A random nonce makes each new message differ from the others; it cannot make an old message new.
Freshness comes from the receiver, from state that the receiver keeps or from a value that the receiver chose.
A replay cache: the receiver stores every nonce it has accepted under the current key and rejects repeats. The collision probability returns here, as the chance of wrongly rejecting an honest message. The cache must survive restarts, or the key must change when the cache is lost. To keep the cache small, messages can also carry an authenticated timestamp: a receiver with a trustworthy clock accepts only timestamps from, for example, the last 5 minutes, and can then forget nonces older than that.
A monotonic counter §8.28: the sender numbers its messages, and the receiver accepts only a number greater than the last one it accepted and stores that number so that it survives power loss.
A challenge: the receiver sends a fresh random nonce, and the sender must include it in the authenticated command. The receiver accepts each challenge at most once. Here a random nonce does provide freshness, because the party that checks it chose it and knows that it is new.
Two conditions hold in every case. The nonce, counter or challenge must lie inside the authenticated bytes; otherwise the attacker replaces it with a value the receiver has not seen, and the tag still verifies. And the two notions have different scopes. An encryption nonce must be unique for as long as its key is used. A freshness rule must hold for as long as an old authenticated message could still be accepted, which includes every restart and reset of the receiver.
Questions answered
Does a random nonce make a command fresh?
No. A random nonce, a value the sender draws at random for one use, makes it unlikely that two honest commands carry the same value, but it does not make a received command fresh, meaning not accepted before. An attacker who records an authenticated command and sends it again repeats the nonce exactly, and the authentication tag still verifies, so the probability of a random collision says nothing about that copy. Freshness requires the receiver to act: to remember the nonces or counter values it has accepted and reject repeats, or to issue its own random challenge that the command must include. In each case the nonce must be covered by the authentication tag, and the receiver’s memory must survive restarts for as long as old commands could still be accepted.
Related entries: Replay attack (§1.26), Birthday bound (§5.6), Authentication coverage (§5.41), Replay resistance requires state or a fresh challenge (§17.10), Monotonic counter (§8.28).