private ICryptoEngine GenerateEngine() { var engine = new AesEngine(txtKey.Text); if (cbxUseKeySize.Checked) { var keySize = EnumerationConversions.GetEnumName<AesKeySize>(cmbKeySize.SelectedItem.ToString()); engine.SetKeySize(keySize); } if (cbxUseInitVector.Checked) { engine.SetInitVector(txtInitVector.Text); } if (cbxUseKeySalt.Checked) { engine.SetSalt(txtSalt.Text); } if (cbxUseRandomSalt.Checked) { engine.SetRandomSaltLength((int)nudSaltMin.Value, (int)nudSaltMax.Value); } if (cbxUsePasswordIterations.Checked) { engine.SetIterations((int)nudIterations.Value); } if (cbxUseEncoding.Checked) { engine.SetEncoding(cmbEncoding.SelectedItem as Encoding); } if (cbxUseHashAlgorithm.Checked) { engine.SetHashAlgorithm((HashType)cmbHashAlgorithm.SelectedItem); } return engine; }