public string Decrypt(string text)
        {
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            switch (this.typeAutoKeyCipher)
            {
            case AutoKeyCipherType.UseText:
                this.PrimaryKey += text;
                break;

            case AutoKeyCipherType.UseCryptogram:
                this.vigenereCipher = new VigenereCipher(this.PrimaryKey + text);
                this.PrimaryKey    += this.vigenereCipher.Encrypt(text);
                break;
            }

            this.vigenereCipher = new VigenereCipher(this.PrimaryKey);

            return(this.vigenereCipher.Decrypt(text));
        }
Пример #2
0
 protected VermanCipher(string sensText)
 {
     this.GeneratedKey   = sensText;
     this.vigenereCipher = new VigenereCipher(this.GeneratedKey);
 }
Пример #3
0
 public VermanCipher(int keyLength)
 {
     this.random         = new Random();
     this.GeneratedKey   = this.GetGeneratedKey(keyLength);
     this.vigenereCipher = new VigenereCipher(this.GeneratedKey);
 }