Skip to content

Commit

Permalink
Add PickANumber example
Browse files Browse the repository at this point in the history
  • Loading branch information
cacay committed Feb 14, 2022
1 parent b998046 commit f79d447
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/src/main/viaduct/synchronization/PickANumber.via
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
host alice : {A}
host bob : {B & A<-}

fun main() {
let $pick = input int from alice;
let $trusted_pick = endorse $pick from {A};

let $guess = input int from bob;
let $revealed_guess = declassify $guess to {A ⊓ B};

let $revealed_pick = declassify $trusted_pick to {A ⊓ B};
let $bob_wins = $revealed_pick == $revealed_guess;

output $bob_wins to alice;
output $bob_wins to bob;
}

0 comments on commit f79d447

Please sign in to comment.