(* Basic weak secret example, from JLAP paper
   Corrected version *)

type skey.
type pkey.
type seed.
type passwd.

(* Probabilistic public-key encryption *)

fun pk(skey): pkey.
fun penc(bitstring, pkey, seed): bitstring.
fun pdec(bitstring, skey): bitstring.
equation forall x: bitstring, y: skey, z: seed;  pdec(penc(x, pk(y), z), y) = x.

(* Hash function *)

fun h(passwd): bitstring.

free c: channel.
free w: passwd [private].

weaksecret w.

process
	new s: skey;
	new a: seed;
	out(c, pk(s));
	out(c, penc(h(w), pk(s), a))

(* EXPECTPV
RESULT Weak secret w is true.
0.032s (user 0.024s + system 0.008s), max rss 8936K
END *)
