Es ist eine Playfair-Verschlüsselung und das Schlüsselwort ist GOLDEN, aber mein Algorithmus kann es nicht herausfinden. Es nutzt Tetragramm-Frequenzen für die Fitness. Ich vermute, dass das Problem etwas mit dem Rand zu tun hat oder dass es einfach daran liegt, dass ich zu primitiven Code für eine solche Aufgabe verwende. In jedem Fall brauche ich eine Möglichkeit, dies zu tun.
Es ist eine Playfair-Verschlüsselung und das Schlüsselwort ist GOLDEN, aber mein Algorithmus kann es nicht herausfinden. Es nutzt Tetragramm-Frequenzen für die Fitness. Ich vermute, dass das [url=viewtopic.php?t=26065]Problem[/url] etwas mit dem Rand zu tun hat oder dass es einfach daran liegt, dass ich zu primitiven Code für eine solche Aufgabe verwende. In jedem Fall brauche ich eine Möglichkeit, dies zu tun. [code]
using System; using System.IO; using System.Linq; namespace keyword_solute { class Program { static void Main() { string path = @"C:\Users\asus\Downloads\english_quadgrams.txt\english_quadgrams.txt"; string[] English_tetragrams = File.ReadAllLines(path); long[] Eng_tetragram_frequencies = new long[English_tetragrams.Length]; int iteration = 0; foreach (string line in English_tetragrams) { Eng_tetragram_frequencies[iteration] = Convert.ToInt64(line.Remove(0, 5)); English_tetragrams[iteration] = line.Remove(line.IndexOf(' ')); iteration++; } long total_engl_frequency = Eng_tetragram_frequencies.Sum(); string Cipher = "EGIWLUQDUOHGKODGRIKTAWTWRDUSERKBDZERNOIRACQUIOIWAHHN"; char[] alphabet = new char []{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; int[,] alphabet_pos = new int[25, 2]; char[,] ParentKey = new char[,] { { 'A', 'B', 'C', 'D', 'E' }, { 'F', 'G', 'H', 'I', 'K' }, { 'L', 'M', 'N', 'O', 'P' }, { 'Q', 'R', 'S', 'T', 'U' }, { 'V', 'W', 'X', 'Y', 'Z' } }; char[,] ChildKey = new char[5, 5]; double BestFitness = fitness_score(Totetragrams(solution(Cipher, ParentKey)), English_tetragrams, Eng_tetragram_frequencies, total_engl_frequency); Random random = new Random(); double margin = 0.0005D * BestFitness * -1; int successful= 0; for (int counter = 0; counter < 30001;) { int trow=0; int tcolumn =0; foreach(char letter in ParentKey) { alphabet_pos[Array.IndexOf(alphabet, letter), 0] = trow; alphabet_pos[Array.IndexOf(alphabet, letter), 1] = tcolumn; tcolumn++; if (tcolumn == 5) { trow++; tcolumn = 0; } }
switch(random.Next(6)) { case 0: int index_1 = random.Next(25); int index_2 = random.Next(25); int[] index_2_pos = new int[] { alphabet_pos[index_2, 0], alphabet_pos[index_2, 1] }; alphabet_pos[index_2, 0] = alphabet_pos[index_1, 0]; alphabet_pos[index_2, 1] = alphabet_pos[index_1, 1]; alphabet_pos[index_1, 0] = index_2_pos[0]; alphabet_pos[index_1, 1] = index_2_pos[1]; break; case 1: int row_index_1 = random.Next(5); int row_index_2 = random.Next(5); int[] row_of_index_2 = new int[5]; for (int i = 0; i < 25; i++) { if (alphabet_pos[i, 0] == row_index_2) { row_of_index_2[alphabet_pos[i, 1]] = i; }
} for(int i = 0; i < 25; i++) { if (alphabet_pos[i, 0] == row_index_1) { alphabet_pos[i, 0] = row_index_2; } } foreach(int letter in row_of_index_2) { alphabet_pos[letter, 0] = row_index_1; } break; case 2: int column_index_1 = random.Next(5); int column_index_2 = random.Next(5); int[] column_of_index_2 = new int[5]; for (int i = 0; i < 25; i++) { if (alphabet_pos[i, 1] == column_index_2) { column_of_index_2[alphabet_pos[i, 0]] = i; }
} for(int i = 0; i < 25; i++) { if (alphabet_pos[i, 1] == column_index_1) { alphabet_pos[i, 1] = column_index_2; } } foreach(int letter in column_of_index_2) { alphabet_pos[letter, 1] = column_index_1; } break; case 3: for(int i =0;i
Mein Beitrag wurde nach der Bewertung gelöscht und ich bin mir nicht sicher, was ich falsch gemacht habe und habe es nicht richtig gemacht. Der ursprüngliche Link ist
Wie man Text ohne Leerzeichen...
Ich arbeite daran, ein Diagramm zu erstellen und die Datenbank mit C# WPF nachzuschlagen.
Es ist mir gelungen, die Datenbanksuche und das Diagramm durchzuführen.
Ist es möglich, ein Diagramm zu...
Ich arbeite daran, ein Diagramm zu erstellen und die Datenbank mit C# WPF nachzuschlagen. Es ist mir gelungen, die DB-Suche und das Diagramm durchzuführen.
Ist es möglich, ein Diagramm dieser Form...
Hallo, ich bin ein Anfänger im HTML-Programmieren und stecke bei einem Code fest.
Ich habe dieses Tutorial verfolgt ( GteJWhCikCk aber mir ist aufgefallen, dass sich die Gesamtform der Box, die ich...
Hallo, ich bin ein Anfänger im HTML-Programmieren und stecke bei einem Code fest.
Ich habe dieses Tutorial verfolgt ( GteJWhCikCk aber mir ist aufgefallen, dass sich die Gesamtform der Box, die ich...