-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add example of using Python builtin
sum()
for secret integers
- Loading branch information
1 parent
203298a
commit e918da3
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from nada_dsl import * | ||
|
||
|
||
def nada_main(): | ||
party_alice = Party(name="Alice") | ||
party_bob = Party(name="Bob") | ||
party_charlie = Party(name="Charlie") | ||
|
||
# Inputs from each party | ||
secret1 = SecretInteger(Input(name="secret1", party=party_alice)) | ||
secret2 = SecretInteger(Input(name="secret2", party=party_bob)) | ||
secret3 = SecretInteger(Input(name="secret3", party=party_charlie)) | ||
|
||
# List of secrets | ||
secrets_list = [secret1, secret2, secret3] | ||
|
||
# Return the sum to party_alice | ||
return [Output(sum(secrets_list), "sum_list", party_alice) for i in range(3)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
program: sum_list | ||
inputs: | ||
secret1: 3 | ||
secret2: 3 | ||
secret3: 3 | ||
expected_outputs: | ||
sum_list: 9 |