cryptographic nonce

Image of Author
March 11, 2023 (last updated May 14, 2023)

A cryptographic nonce is a number used just once in communication.

One example use case is in "randomizing" the output of a hash function. Hash functions are designed to generate arbitrary output even when faced with very similar inputs. One example of this use case is in a blockchain#Proof of Work system where machines compete to discover a hash function output with certain properties (say a number of leading zeros). The input value often encodes pieces a data which can be predictable, which would allow a bad actor to precompute the discovered inputs/proofs. To prevent this a nonce is required as a part of the input value, guaranteeing that computation cannot begin until the nonce is announced, which signals the start of the competition.

Etymology of 'nonce'

The usage of the phrase "cryptographic nonce" was inspired by "nonce words". Nonce words are words created for a single occasion, for some momentary purpose where no current word is appropriate or desired.

Nonce words are related to other classes of words, such as nonsense words, portmanteaus, and neologisms. Nonce words are by definition a neologism. They can be nonsense words if their purpose is to be nonsensical, but they need not be. For example, "fluddle" was created for the purpose of describing a body of water with some properties of a flood and a puddle. Fluddle was speculated as capable of entering the english dictionary, but it did not.

There are many famous examples of nonce words, particularly ones that eventually made their way into the english dictionary. "Grok" from Robert Heinlein's Stranger in a Strange Land, "chortle" from the poem Jabberwocky in Alice in Wonderland, "chortle". "Quark" from Finnegan's Wake from which physicist Murray Gell-Mann was inspired to name the subatomic particle.

The term "nonce words" was coined because of the old phrase "for the nonce" meaning essentially "just this once", or "for the time being". The word "nonce" comes from the Middle English phrase "then anes" meaning "the one" ("then" being a Middle English form of "the", and "anes" being "once", or "one"). The "n" migrated to become "the nanes", and then "the nonce". This is an example of what the Oxford English Dictionary calls "wrong division".

(Other examples of "wrong division" are as follows. "Newt" from Middle English "an eft", then "neft", then "newt", with eft being the original name for the animal. Also, "nickname" from Middle English "an eke-name", then "nekename", with eke meaning "addition". And, wrong division works both ways! "Apron" from Middle English "a naperon", then "an aperon")