ctSwapBigInt

fnvoid ctSwapBigInt(uint doSwap, ref BigInt a, ref BigInt b) pure nothrow @safe

Swaps two BigInt values conditionally in constant time.

This function swaps a and b if doSwap is non-zero, or leaves them unchanged if doSwap is 0. The operation is performed without branching to prevent timing leaks.

Note

This function extends both BigInts to the same

limb count before swapping to ensure correct behavior.

Parameters

doSwapSwap flag (0 = no swap, non-zero = swap).
aFirst BigInt (may be modified).
bSecond BigInt (may be modified).