nonce

A value meant to be used only once, such as a unique number given to a cipher or a random token that marks trusted scripts in a web page.

In more detail

The name is short for number used once. In encryption, ciphers take a nonce alongside the key; it does not have to be secret, only never repeated with the same key. In a Content Security Policy, the server sends a fresh unpredictable nonce with every response and repeats it on each trusted script tag, so injected scripts without it are refused. In network protocols, nonces also stop old messages from being replayed.

Example

NONCE = bytes(12)              # used once with this key, never again

Related terms

Taught in

References