fhenix-encrypted-conditionals
Installation
SKILL.md
Fhenix Encrypted Conditionals
Overview
You cannot use if/else or require on encrypted conditions — the value is hidden, and branching/reverting based on it leaks information through execution paths and timing (like a non-constant-time crypto routine). Instead use FHE.select, the encrypted ternary:
// FHE.select(ebool condition, T ifTrue, T ifFalse) -> T (T = any encrypted type, incl. eaddress)
euint32 max = FHE.select(a.gt(b), a, b);
Both branches are always evaluated; the correct result is chosen homomorphically without revealing which.
Don't / Do
// ❌ leaks info — both the branch taken and timing are observable
if (a.gt(b)) { max = a; } else { max = b; }