Documentation

CslibFrontier.Crypto.Computational.PseudorandomPermutation.StrongSwitching

The ideal strong-PRP game against the forgetful sampler #

A StrongPRPDistinguisher asks words on two channels: channel false for the permutation and channel true for its inverse. strongBitStringCodec m reads such a request with an m-bit word as a typed PermQuery (BitString m) (strongPermCodec in Crypto.Computational.LubyRackoff reads it as a query on pairs of halves), so that the ideal strong-PRP game strongPRPIdealGame becomes the typed experiment PRP.strongIdealExperiment (strongPRPIdealGame_eq_strongIdealExperiment). The bidirectional switching bound of CslibFrontier.Crypto.Primitives.PRP.StrongSwitching then compares the ideal game with its run against RandomPermutation.forgetfulAnswer, the lazy sampler that keeps the pairs (x, y) it has answered, answers .forward x or .inverse y from a recorded pair when there is one, and otherwise with a fresh uniform block, which may repeat a recorded one. The forgetful sampler is neither a random function nor a random permutation; it is the object that RandomPermutation.abs_sub_uniformPerm_forgetful_le compares a uniform permutation with.

The bound is information-theoretic: nothing is claimed about running time.

Main definitions #

Main results #

Bidirectional requests on m-bit blocks: channel true asks for the inverse.

theorem Cslib.Crypto.strongBitStringCodec_wordOracle_of_length {M : Type → Type} [Monad M] {m : ℕ} (oracle : RandomPermutation.PermQuery (BitString m) → M (BitString m)) (inverse : Bool) {word : List Bool} (hword : word.length = m) :

On a request of the block length, the word oracle of strongBitStringCodec asks the typed query and writes the reply as a word.

theorem Cslib.Crypto.strongBitStringCodec_wordOracle_of_length_ne {M : Type → Type} [Monad M] {m : ℕ} (oracle : RandomPermutation.PermQuery (BitString m) → M (BitString m)) (inverse : Bool) {word : List Bool} (hword : word.length ≠ m) :
(strongBitStringCodec m).wordOracle oracle (inverse, word) = pure []

On any other request, the word oracle of strongBitStringCodec answers [].

A permutation table presents strongRandomPermOracle on the word channels.

theorem Cslib.Crypto.strongPRPIdealGame_eq_strongIdealExperiment (blockLen : ℕ → ℕ) (adversary : StrongPRPDistinguisher) (n : ℕ) :
strongPRPIdealGame blockLen adversary n = PRP.strongIdealExperiment ((strongBitStringCodec (blockLen n)).adapt (adversary n []))

The ideal strong-PRP game is the typed ideal chosen-ciphertext experiment PRP.strongIdealExperiment of the adversary that reads valid words as blocks through strongBitStringCodec (blockLen n).

A strong-PRP distinguisher against the forgetful sampler: a distinguisher making at most Q calls tells the ideal strong-PRP game from its run against the forgetful lazy sampler with advantage at most Q.choose 2 / 2 ^ blockLen n. This is PRP.advantage_strongIdealExperiment_forgetful_le for the adversary reading valid words as blocks through strongBitStringCodec (blockLen n).