oplss2024/stoughton/example1

19 lines
434 B
Text
Raw Permalink Normal View History

2024-06-11 02:56:36 +00:00
type key. (* encryption keys, key_len bits *)
type text. (* plaintexts, text_len bits *)
type cipher. (* ciphertexts *)
module type ENC = {
proc key_gen(): key
proc enc(k: key, x: text): cipher
proc dec(k: key, c: cipher): text
}
module Cor (Enc: ENC) = {
proc main(x: text): bool = {
var k: key; var c: cipher; var y: text;
k <@ Enc.key_gen();
c <@ Enc.enc(k, x);
y <@ Enc.dec(k, c);
return x = y;
}
}