Skip to main content

Nada Operations

This chart shows all supported Nada operations, their syntax, and supported data types. Each operation has a linked example Nada program.

Operation with linked exampleSyntaxSupported Types
(P: Public, S: Secret)
Additionx + yP ← P + P,
S ← P + S,
S ← S + P,
S ← S + S
Subtractionx - yP ← P - P,
S ← P - S,
S ← S - P,
S ← S - S
Multiplicationx * yP ← P * P,
S ← P * S,
S ← S * P,
S ← S * S
Powerx ** yP ← P ** P
Divisionx / yP ← P / P,
S ← P / S,
S ← S / P,
S ← S / S
Modulox % yP ← P % P,
S ← P % S,
S ← S % P,
S ← S % S
Left shift and Right shiftx << y,
x >> y
P ← P << P,
S ← S << P
Probabilistic truncationx.trunc_pr(y)S ← S.trunc_pr(P)
Comparisonsx < y,
x <= y,
x > y,
x >= y
P ← P < P,
S ← P < S,
S ← S < P,
S ← S < S
Ternary "if else"
(public condition)
cond.if_else(x, y)P ← P.if_else(P, P),
S ← P.if_else(P, S),
S ← P.if_else(S, P),
S ← P.if_else(S, S)
Ternary "if else"
(secret condition)
cond.if_else(x, y)S ← S.if_else(P, P),
S ← S.if_else(P, S),
S ← S.if_else(S, P),
S ← S.if_else(S, S)
Reveal
(convert a private
value into a public value)
x.reveal()P ← S.reveal()
Equalityx == yS ← S == S,
S ← S == P,
S ← P == S,
P ← P == P
Public Output Equality
(publicly output if two secrets are equal)
x.public_equals(y)P ← S.public_equals(S)
Not~boolS ← ~S,
P ← ~P