symmetric static method
Creates a symmetric cipher based on the given algorithm.
algorithm: The symmetric cipher algorithm (AES, DES)
input: The complete input record with configuration
Returns: An instance of the specified symmetric cipher
Throws: ArgumentError if algorithm is not supported
Note: For ChaCha20, use the chacha20 factory method instead.
Implementation
static ISymmetricCipher symmetric(
SymmetricCipherAlgorithm algorithm,
InputSymmetricCipher input,
) {
return switch (algorithm) {
AESAlgorithm() => AESCipher.createFull(InputAESCipher(parent: input)),
DESAlgorithm() => DESCipher.createFull(InputDESCipher(parent: input)),
ChaCha20Algorithm() => throw ArgumentError(
'Use chacha20() factory method for ChaCha20 cipher',
),
};
}