public DecipherText(CipherText cipherText, string key, ICryptography decryptor)
 {
     CipherText     = cipherText;
     DecipheredText = decryptor.Decrypt(cipherText, key);
     Key            = key;
     Score          = new FrequencyAnalysis(DecipheredText).Score;
 }
        public DecipherText Crack(CipherText cipherText, int keyLength = 0)
        {
            if (keyLength == 0)
            {
                keyLength = FindKeyLength(cipherText.Bytes);
            }
            string key = GetKey(cipherText.Bytes, keyLength);

            return(new DecipherText(cipherText, key, new VigenerCipher()));
        }
        public string Decrypt(CipherText cipherText, string key)
        {
            byte[] expandedKey = ExpandKey(key.ToByteArray(), cipherText.Length);

            return(expandedKey.XorWith(cipherText.Bytes).ToASCIIString());
        }