Cha Cha.From Key Method
Definition
Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| From | Creates a new ChaCha instance with the specified key and nonce/counter initialized to zero. |
| From | Creates a new ChaCha instance with the specified key and nonce. |
FromKey(ReadOnlySpan<UInt32>)
Creates a new ChaCha instance with the specified key and nonce/counter initialized to zero.
public static ChaCha FromKey(
ReadOnlySpan<uint> key
)Parameters
- key ReadOnlySpan<UInt32>
- The 256-bit key (8 × 32-bit words).
Return Value
ChaChaA new ChaCha instance with the specified key and zero nonce/counter.
Remarks
This factory method directly sets the ChaCha key and initializes the nonce/counter to zero, providing direct access to the counter-based RNG's key/nonce interface.
Exceptions
| Argument | Thrown when key length is not exactly 8. |
FromKey(ReadOnlySpan<UInt32>, ReadOnlySpan<UInt32>)
Creates a new ChaCha instance with the specified key and nonce.
public static ChaCha FromKey(
ReadOnlySpan<uint> key,
ReadOnlySpan<uint> nonce
)Parameters
- key ReadOnlySpan<UInt32>
- The 256-bit key (8 × 32-bit words).
- nonce ReadOnlySpan<UInt32>
- The nonce (2, 3, or 4 × 32-bit words depending on ChaCha variant).
Return Value
ChaChaA new ChaCha instance with the specified key and nonce.
Remarks
This factory method directly sets the ChaCha key and nonce, providing direct access to the counter-based RNG's key/nonce interface.
Exceptions
| Argument | Thrown when key or nonce length is incorrect. |