Glossary
Nonce (number used once)
Definition
Nonce: A value, often random or a counter, that a security protocol uses only once with a given key or in a given exchange. It is usually not secret, but it must not repeat, or encryption and replay protection can fail.
Also known asnumber used oncecryptographic nonceinitialization vector
In short
A nonce, short for "number used once," is a value a security protocol uses a single time with a given key or in a given exchange. Encryption uses nonces so the same message never encrypts the same way twice, and sign-in protocols use them to stop replayed answers. Nonces are usually not secret. They fail when they repeat, as the 2017 Wi-Fi KRACK attack showed.
Key takeaways
- A nonce must never repeat with the same key; it doesn't have to be secret.
- Encryption, challenge-response sign-in and web page script rules all rely on nonces.
- A repeated nonce can let an attacker decrypt, replay or forge messages.
- Nonces come from counters that never reset or from a strong random source.
Last reviewed 3 December 2026 by Foxcolab Team
A nonce, short for "number used once," is a value that a security protocol uses a single time with a given key or in a given exchange. NIST's glossary collects several definitions, among them "a value that is used only once" and "a value used in security protocols that is never repeated with the same key." A nonce is usually not secret. What matters is that it never comes back.
Where you meet nonces#
- Encryption. Many encryption methods take a key, a nonce and the message. With a fresh nonce each time, encrypting the same text twice gives two unrelated pieces of ciphertext, so an observer can't even tell the messages match.
- Sign-in. In challenge-response sign-in, the server sends a fresh challenge and your device answers it. A recorded answer is useless later because the challenge has changed. NIST notes that nonces used as challenges "must not be repeated."
- Web pages. A site can tag its own scripts with a nonce listed in its Content Security Policy. The browser runs scripts that carry it and blocks scripts an attacker manages to inject.
What happens when a nonce repeats#
In many common encryption modes, two messages encrypted with the same key and nonce leak each other: an attacker who knows one message can work out the other. In 2017, Mathy Vanhoef and Frank Piessens showed this was more than theory. Their KRACK attack tricked Wi-Fi devices into reinstalling a key, which reset "the incremental transmit packet number (i.e. nonce)." With old nonces back in use under the same key, "packets can be replayed, decrypted, and/or forged." The encryption itself was sound. The repeated nonce broke it.
Counters and random values#
Nonces come from one of two places:
| Source | How it stays unique | How it fails |
|---|---|---|
| Counter | Counts up and never resets | State is lost or reset, as in KRACK |
| Random | So large that a repeat is practically impossible | The random source is weak |
In Foxcolab#
Each time your device encrypts something, it draws a fresh random nonce. Foxcolab Drive encrypts every piece of an uploaded file with its own nonce, and your account key gets a new one each time it's locked with a new password. The nonce is stored next to the ciphertext, which is fine, because it was never meant to be secret. The Docs, Sheets and Notes web apps also send a fresh script nonce with every page, so the browser blocks scripts the page didn't come with.
Drive files and file names, Docs, Sheets and Notes are end-to-end encrypted, so Foxcolab can't read them. Create a free account.
Keep exploring
Related terms
- EncryptionEncryption turns readable data into ciphertext that only the holder of the right key can turn back. Who holds that key decides who can read your data.
- CiphertextCiphertext is data after encryption, scrambled so it reveals nothing useful without the key. Where the key lives decides who can turn it back into readable data.
- Encryption in transit (TLS)Encryption in transit protects data while it crosses a network, usually with TLS. It stops eavesdroppers, but every server along the way can still read the data.
- End-to-end encryption (E2EE)End-to-end encryption keeps data encrypted from the sender's device to the recipient's device, so the servers in between only ever handle ciphertext.
- Salt (password salt)A salt is a random value added to a password before it's hashed, so identical passwords never produce identical hashes and precomputed cracking tables stop working.
Where Foxcolab uses it

Foxcolab
Private work tools, without the ads.
Mail, files, documents, spreadsheets and meetings in one account. Files, documents and spreadsheets are end-to-end encrypted.