Also ich habe erst begonnen einen kleinen Verschlüsselungsalgorithmus zu coden.
Dieser Algorithmus soll nach dem Prinzip der Vigenere Verschlüsselung funktionieren.
Für den Anfang habe ich den Algorithmus ziemlich nunja statisch gehalten der schluessel ist immer der selbe und das "Passwort" auch(zur Kontrolle),
aber leider funktioniert der Algorithmus noch nicht so wie ich das haben wollte...
Hier erstmal der Code
new buchstaben[][] = {
{" ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"},
{"A","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"},
{"B","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A"},
{"C","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B"},
{"D","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C"},
{"E","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D"},
{"F","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E"},
{"G","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F"},
{"H","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G"},
{"I","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H"},
{"J","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I"},
{"K","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J"},
{"L","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K"},
{"M","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L"},
{"N","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M"},
{"O","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N"},
{"P","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"},
{"Q","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"},
{"R","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q"},
{"S","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R"},
{"T","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S"},
{"U","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T"},
{"V","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U"},
{"W","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"},
{"X","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W"},
{"Y","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X"},
{"Z","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y"}
};
stock GetChar(string[],stelle)
{
new test[2];
test[0] = string[stelle];
return test;
}
stock verschl(pw[])
{
new schluessel[6]="CDEAB";
while(i<27)
{
if(strcmp(GetChar(pw,0),buchstaben[0][i],false)==0)
{
while(j<27)
{
if(strcmp(GetChar(schluessel,0),buchstaben[j][0],false)==0)
{
return printf("%c blub %c blub %s",GetChar(schluessel,0),GetChar(pw,0),buchstaben[j][i]);
}
j ++;
}
}
i ++;
}
return print("Nichts");
}
Wie man sehen kann soll beim erfolgreichen durchführen das 1. Zeichen des Schlüssel, das 1. Zeichen des Passwortes und die Verschlüsselung des 1. Zeichen des Passwortes geprinted werden....das funktioniert auch fast wunderbar nur leider wird der verschlüsselte Buchstabe nicht geprinted aber der Rest schon
Die Verwendung des ganzen sieht wie folgt aus
verschl("HALLO"); // HALLO ist das pw
Hoffentlich kann mir jmd. sagen wieso der verschlüsselte Buchstabe nicht geprinted wird.
Ich hoffe ihr habt mein Problem verstanden und, dass mir jmd. helfen kann.
PS: Ja es ist resourccenfressend aber ich bin Anfänger^^ und das ist Quasi die 0.0000000000000001 Alpha^^