Thema: Delphi Verschlüsselung

Einzelnen Beitrag anzeigen

Curby

Registriert seit: 29. Sep 2003
17 Beiträge
 
#1

Verschlüsselung

  Alt 29. Sep 2003, 18:58
Ich bin Anfänger und bin grad dabei ein Verschlüsselungsprogramm zu schreiben. Codieren klappt bestens, aber das decodieren will mir nicht gelingen. Ich kann machen was ich will, aber mit dieser Prozedur will das einfach nicht klappen - wird wahrscheinlich ziemlich falsch sein, aber ich bin eben Anfänger...
Nun meine Bitte an Euch - Helft mir, denn ich komm nicht mehr weiter und mein Latein ist am Ende...
Kann mir bitte jemand diese Prozedur so umschreiben, dass ich damit Texte decodieren kann?
Vielen Dank für Eure Hilfe


Delphi-Quellcode:
var
  i : integer;
  EncodedKey : string;
  Key : Char;
  Geheimtext : Array[65..90] OF String
  = ('XZYJVPQ','XYJVPQZ', 'JXZYVPQ', 'XZYJQVP', 'XZJVPQY', 'XZYVJPQ', 'JVPQXZY', 'ZYJVXPQ',
   'JVPXZYQ','XVZYJPQ', 'XZYQJVP', 'XZJVYPQ', 'XZYJPVQ', 'XZYJVQV', 'XYJZVPQ', 'XYJVZPQ', 'YJVPQXZ'
    ,'QXZYJVP', 'XZYPJVQ','ZYJVPQX', 'XZYVJPQ' , 'XZJYVPQ','XZYJVQP','ZYJXVPQ', 'XZYJPQV' ,'XZYVPQJ');

begin
  Klartext := '' ;
  Vorbehandeln(Geheimtext);

  For i:=65 TO 90 DO

     if Geheimtext = Geheimtext[i] then
        begin
                result := Chr(i);
                exit;
        end;
                result := '*';
        end;

Case Key of
'XZYJVPQ': EncodedKey:= 'A';
'XYJVPQZ': EncodedKey:= 'B';
'JXZYVPQ': EncodedKey:= 'C';
'XZYJQVP': EncodedKey:= 'D';
'XZJVPQY': EncodedKey:= 'E';
'XZYVJPQ': EncodedKey:= 'F';
'JVPQXZY': EncodedKey:= 'G';
'ZYJVXPQ': EncodedKey:= 'H';
'JVPXZYQ': EncodedKey:= 'I';
'XVZYJPQ': EncodedKey:= 'J';
'XZYQJVP': EncodedKey:= 'K';
'XZJVYPQ': EncodedKey:= 'L';
'XZYJPVQ': EncodedKey:= 'M';
'XZYJVQV': EncodedKey:= 'N';
'XYJZVPQ': EncodedKey:= 'O';
'XYJVZPQ': EncodedKey:= 'P';
'YJVPQXZ': EncodedKey:= 'Q';
'QXZYJVP': EncodedKey:= 'R';
'XZYPJVQ': EncodedKey:= 'S';
'ZYJVPQX': EncodedKey:= 'T';
'XZYVJPQ': EncodedKey:= 'U';
'XZJYVPQ': EncodedKey:= 'V';
'XZYJVQP': EncodedKey:= 'W';
'ZYJXVPQ': EncodedKey:= 'X';
'XZYJPQV': EncodedKey:= 'Y';
'XZYVPQJ': EncodedKey:= 'Z';
end;

Klartext := Klartext + EncodedKey;

  end;

end;
  Mit Zitat antworten Zitat