https://github.com/EasyCrypt/easycrypt
Raw File
Tip revision: cd974a77f59ee803c453d808feb78c05cf2c229e authored by Pierre-Yves Strub on 23 January 2023, 10:23:53 UTC
[theories]: ring with generic (choice based) inverse
Tip revision: cd974a7
PRG.eca
type output.
op dout:output distr.

module type RG = {
  proc init(): unit
  proc next(): output
}.

module type RGA = { proc next(): output }.

module type Distinguisher(G:RGA) = { proc distinguish(): bool }.

module IND(G:RG,D:Distinguisher) = {
  module D = D(G)

  proc main(): bool = {
    var b;

    G.init();
    b <@ D.distinguish();
    return b;
  }
}.

module PRGi:RG,RGA = {
  proc init(): unit = { }
  proc next(): output = { var r; r <$ dout; return r; }
}.

(** Advantage of a distinguisher against a PRG G:
      Adv_G(D) = `|IND(G,D) - IND(PRGi,D)|        **)
back to top