ChaChaEngine.Permute Method

Applies the ChaCha permutation to a 16-word (512-bit) state.

Definition

Namespace: Numerics.NET.Random.Engines
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public static void Permute(
	Span<uint> state,
	int rounds
)

Parameters

state  Span<UInt32>
The 16-word state to permute. Must have exactly 16 elements.
rounds  Int32
The number of rounds to apply (must be 8, 12, or 20).

Remarks

This method performs the ChaCha permutation in-place on the provided state. The state is modified directly and represents the output after the specified number of rounds.

Note: This method performs only the permutation step. To generate the final ChaCha output block, the original state must be added to the permuted state (ARX construction).

Exceptions

ArgumentExceptionThrown when state length is not 16 or rounds is not 8, 12, or 20.

See Also