init method
Implementation
void init(bool forEncryption, CipherParameters params) {
if (params is ParametersWithSBox) {
var param = params;
//
// Set the S-Box
//
var sBox = param.SBox;
if (sBox.length != sboxDefault.length) {
throw Exception("invalid S-box passed to GOST28147 init");
}
_S = List.filled(sBox.length, 0);
GOST28147Engine._arraycopy(sBox, 0, _S, 0, sBox.length);
//
// set key if there is one
//
if (param.Parameters != null) {
_workingKey = _generateWorkingKey(
forEncryption,
(param.Parameters as KeyParameter).Key,
);
}
} else if (params is KeyParameter) {
_workingKey = _generateWorkingKey(forEncryption, (params).Key);
} else
throw Exception("invalid parameter passed to GOST28147 init");
}