← Back to section · Foundations of Cryptography

The Random Oracle Model: Treating a Hash Function as an Ideal Random Function

Many security proofs for signatures and encryption assume the hash function is a «random oracle»: returning a fresh random output for every new input, queryable by anyone. This article explains the model, why it makes proofs possible, classic uses such as Fiat–Shamir, and the famous gap between the model and real hash functions.

Published 22 November 2026 · 5 min read · PQ Frontier

The Random Oracle Model: Treating a Hash Function as an Ideal Random Function
AI-generated site artwork
Video explainer · Mathematical foundations: the language of cryptography

Open the security proof of a signature scheme and you will often meet the sentence: “this scheme is secure in the random oracle model”. The “random oracle” in that sentence is not a piece of equipment but an idealised assumption: imagine the hash function used by the scheme as a globally shared, perfectly random machine. This article explains the rules of that imaginary machine, why it makes proofs possible at all, and why cryptographers both rely on it and distrust it. Understanding it is a key piece for reading modern security proofs — alongside the reduction method of the previous article.

The model: a random machine anyone may query

A random oracle is an imaginary function H. Anyone may submit an input x and receive H(x), under three rules. First, for each x asked for the first time, the output is a fresh value drawn uniformly from the output space. Second, repeated queries for the same x always return the same answer — it is a function, consistent throughout. Third, every party, the adversary included, can interact with it only by querying; nobody sees any “implementation”. In other words, it is an infinitely large lookup table filled at random, and everyone consults the same table.

The distance to a real hash function such as SHA-256 is obvious: a real hash is a fixed, public, short program computable offline, its outputs fully determined by the algorithm, containing no randomness at all — it merely looks random in the sense that nobody has yet found structural weakness in it. The random oracle model takes this “no weakness found yet” and idealises it in one step into “no weakness exists”.

Why proofs need it: programmability and extractability

Provers love this machine because, inside a reduction proof, it grants two superpowers no real hash function offers. The first is programmability: when the reduction algorithm plays the role of the oracle answering queries, it may, at crucial points, answer not at random but with values it prepared — for instance, embedding an instance of the hard problem as the answer to some query. The adversary cannot distinguish the random environment from the reduction’s environment, so its scheme-breaking output can be “translated” by the reduction into a solution of the hard problem. The second is extractability (observability): the reduction sees the adversary’s entire query log and hence knows what the adversary “has asked”; in many proofs, an adversary that never queried some critical input cannot forge an output depending on it — and the proof closes exactly on this point.

The most classic application is the Fiat–Shamir transform, which replaces the verifier’s random challenge in an interactive proof by a hash of the preceding messages, turning interactive proofs into non-interactive signatures. Its security argument is essentially this: the simulator can program the oracle so that simulated transcripts look legitimate, while a forger must commit before knowing what the challenge will be — logic that is meaningless without programmability. The standard proofs of a large family of schemes, including RSA-FDH and Schnorr signatures, likewise stand in this model.

How far is a real hash from the oracle?

So how far is a real hash function such as SHA-256 from the oracle? Classical cryptography asks a hash for three properties: preimage resistance, second-preimage resistance and collision resistance (see the hash-function articles in this section). These are “pointwise” properties, whereas the oracle assumes total absence of structure: outputs must look truly random under every statistical test, without even small structural blemishes such as length extension — and the Merkle–Damgård structure used by the MD family, SHA-1 and SHA-2 has exactly the length-extension property built in, which has bitten constructions that treat the hash as a random function (naively using H(key‖message) for message authentication, for instance), until designs like HMAC were created specifically to route around the structural blemish. The lesson runs both ways: structural details the oracle model irons flat can be the very entry point of an attack in a concrete construction; conversely, analyses tailored to a concrete hash usually cannot avoid some idealisation either. The engineering consensus is to prefer constructions that have random-oracle proofs and whose hash usage avoids known structural blemishes, with parameters carrying a comfortable margin.

The famous gap: uninstantiability

Yet the model carries a theoretically hard wound. In 1998, Canetti, Goldreich and Halevi constructed contrived schemes that are provably secure in the random oracle model but insecure when the oracle is replaced by any concrete function family. Logically, then, “secure in the random oracle model” does not automatically imply “secure after instantiation” — there is no bridge theorem between model and reality, only experience: over the decades, schemes proved in the random oracle model and instantiated with well-designed hash functions have overwhelmingly held up in practice (OAEP, Schnorr-type signatures), and the occasional failure has usually traced back to implementation and parameters rather than the model itself. The community’s working attitude is therefore: a random oracle proof is weighty heuristic evidence, especially when the scheme is structurally simple and uses the hash as a black box; but it ranks below a standard-model proof, which uses only concrete complexity assumptions.

The post-quantum era adds another layer: a quantum adversary can query the oracle in superposition, and most classical programmability and extraction techniques must be rebuilt — giving rise to the quantum random oracle model (QROM). Security analyses of post-quantum signatures (hash-based signatures, parts of the analysis of ML-DSA) must state whether they stand in the classical ROM or in the QROM. Asking that extra question when reading a conclusion is the new rule of the quantum age.

Summary

The random oracle is cryptography’s most useful fiction: it packages the empirical judgement “this hash behaves as if random” into a reason-able axiom, and in exchange delivers provability for a large family of schemes. The correct posture is double: use it fully when designing and analysing, but remember its identity when reading conclusions — it is a model, not a machine that exists. Whenever its name appears in a security claim, silently re-read the claim as: “secure, provided the hash behaves ideally”.

One emerging consensus is worth recording: as formal verification tools mature, some classical random-oracle proofs are being machine-checked line by line. That eliminates human oversight errors, but it does not change the model’s status — tools can guarantee “the proof is correct within the model”, not “the model equals reality”. Keeping these two layers of confidence separate is the basic discipline for reading any modern security argument.

Tags: Random OracleHash FunctionsSecurity Models