public EncryptHelper SetEcryptType(EEncodinType type) { switch (type) { case EEncodinType.Caesar: this.EncryptConfig = new EncryptConfigCaesar(); this.KeyGenerator = new KeyGeneratorCaesar(); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(this); }
public ICryptResult Encrypt(string message, EEncodinType type, IEncryptConfig config) { string configKey = config.Key; string result = ""; foreach (char letter in message) { char cipher = Cipher(letter, Int32.Parse(configKey)); result += cipher; } return(new CryptResult() { CryptData = result, Key = configKey }); }