A nonce is an arbitrary number or value used only once in a cryptographic communication to ensure security and uniqueness. It is often random or pseudo- random, sometimes including a timestamp, and serves to prevent replay attacks by making each communication session unique. Nonces are used in authentication protocols, cryptographic hash functions, initialization vectors, and other security contexts to ensure that old communications cannot be reused fraudulently.
In addition to cryptography, a nonce can also refer to a security mechanism in web applications to allow specific inline scripts to run by associating a unique nonce attribute to them, preventing malicious script injections.
Outside of technical contexts, "nonce" is a British slang term for a convicted or alleged sex offender, especially involving children, but this meaning is distinct from the cryptographic and security meanings.