Exemplo n.º 1
0
 /******************* KONEC *********************/
 public int[] GetKey(string ciphertext)
 {
     KeyLength keyLength = new KeyLength();
     return keyLength.GetKeyLength(ciphertext).Where(x => x < 30).Where(x => x > 4).Take(1).ToArray();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Crackovací metoda, která se nejprve pokusí zjistit délku klíče
        /// a následně se pokusí prolomit šifru standardně.
        /// </summary>
        /// <param name="ciphertext"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        private List<string> TestKeyLengthAttack(string ciphertext, Storage.Languages language)
        {
            KeyLength keyLength = new KeyLength();
            var keysLength = keyLength.GetKeyLength(ciphertext).Take(6).ToArray();

            if (keysLength.Length == 0)
                keysLength = new int[MaxKeyLength - 2].Fill(x => x + 2);

            return BruteForceAttack(ciphertext, language, keysLength);
        }