Skip to content

Commit 3fac4a3

Browse files
committed
Optimisation: Arcis automatically converts secret-indexed array access to oblivious operations
1 parent 48e8926 commit 3fac4a3

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

encrypted-ixs/src/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ mod circuits {
4444
let user_choice = choice_ctx.to_arcis();
4545
let mut vote_counts = vote_counts_ctx.to_arcis();
4646

47-
// Increment appropriate counter based on choice value
48-
// Note: Must use explicit conditionals to avoid information leakage in encrypted circuits
49-
if user_choice.choice == 0 {
50-
vote_counts[0] += 1;
51-
} else if user_choice.choice == 1 {
52-
vote_counts[1] += 1;
53-
} else {
54-
vote_counts[2] += 1;
55-
}
47+
// "Arcis automatically converts secret-indexed array access to oblivious operations."
48+
// https://docs.arcium.com/developers/arcis/operations
49+
vote_counts[user_choice.choice as usize] += 1;
5650

5751
vote_counts_ctx.owner.from_arcis(vote_counts)
5852
}

0 commit comments

Comments
 (0)