bin grade nichzt zu hause, ich schick euch von mir aus den ganzen code.
soll ich euch auch den Code für die verschlüsselung schicken? das wird dann halt nur nen ziemlich langer post, weil ich das alles mit realtiv wenig befehlen gemacht hab, weil ich noch nicht so skilled in delphi bin.
das von dir Hawkeye219 probier ich mal aus, könnte echt das Problem sein, thx
Nachtrag:
Okay hier jetzt die ganze umkonvertierung von den Zeichen zur Zahl...
Code:
Var
buffer: string;
Zufall1, ZUfall2: integer;
i, buffer2: integer;
CodeVar: integer;
begin
try CodeVar:= strtoint(Codex.Text); except showmessage('Code ist keine Zahl'); end;
Geheimcodeform.GeheimcodeText.Text:='';
for i:=1 to length(OriginalText.Text) do begin
buffer:=Originaltext.Text[i];
Zufall1:=random(10);
Zufall2:=random(100);
//Konvertierungstabelle
if buffer='a' then Buffer2:=1 else if buffer='b' then Buffer2:=2 else if buffer='c' then Buffer2:=3 else
if buffer='d' then Buffer2:=4 else if buffer='e' then Buffer2:=5 else if buffer='f' then Buffer2:=6 else
if buffer='g' then Buffer2:=7 else if buffer='h' then Buffer2:=8 else if buffer='i' then Buffer2:=9 else
if buffer='j' then Buffer2:=10 else if buffer='k' then Buffer2:=11 else if buffer='l' then buffer2:=12 else
if buffer='m' then Buffer2:=13 else if buffer='n' then Buffer2:=14 else if buffer='o' then buffer2:=15 else
if buffer='p' then Buffer2:=16 else if buffer='q' then Buffer2:=17 else if buffer='<' then Buffer2:=18 else
if buffer='r' then Buffer2:=19 else if buffer='s' then Buffer2:=20 else if buffer='t' then Buffer2:=21 else
if buffer='u' then Buffer2:=22 else if buffer='v' then Buffer2:=23 else if buffer='w' then Buffer2:=24 else
if buffer='x' then Buffer2:=25 else if buffer='y' then Buffer2:=26 else if buffer='z' then Buffer2:=27 else
if buffer='!' then Buffer2:=28 else if buffer='"' then Buffer2:=29 else if buffer='§' then Buffer2:=30 else
if buffer='$' then Buffer2:=31 else if buffer='%' then Buffer2:=32 else if buffer='&' then Buffer2:=33 else
if buffer='/' then Buffer2:=34 else if buffer='(' then Buffer2:=35 else if buffer=')' then Buffer2:=36 else
if buffer='=' then Buffer2:=37 else if buffer='?' then Buffer2:=38 else if buffer='*' then Buffer2:=39 else
if buffer='+' then Buffer2:=40 else if buffer='#' then Buffer2:=41 else if buffer='-' then Buffer2:=42 else
if buffer='_' then Buffer2:=43 else if buffer=':' then Buffer2:=44 else if buffer='.' then Buffer2:=45 else
if buffer=',' then Buffer2:=46 else if buffer=';' then Buffer2:=47 else if buffer=' ' then Buffer2:=48 else
if buffer='A' then Buffer2:=49 else if buffer='B' then Buffer2:=50 else if buffer='C' then Buffer2:=51 else
if buffer='D' then Buffer2:=52 else if buffer='E' then Buffer2:=53 else if buffer='F' then Buffer2:=54 else
if buffer='G' then Buffer2:=55 else if buffer='H' then Buffer2:=56 else if buffer='I' then Buffer2:=57 else
if buffer='J' then Buffer2:=58 else if buffer='K' then Buffer2:=59 else if buffer='L' then buffer2:=60 else
if buffer='M' then Buffer2:=61 else if buffer='N' then Buffer2:=62 else if buffer='O' then buffer2:=63 else
if buffer='P' then Buffer2:=64 else if buffer='Q' then Buffer2:=65 else if buffer='>' then Buffer2:=66 else
if buffer='R' then Buffer2:=67 else if buffer='S' then Buffer2:=68 else if buffer='T' then Buffer2:=69 else
if buffer='U' then Buffer2:=70 else if buffer='V' then Buffer2:=71 else if buffer='W' then Buffer2:=72 else
if buffer='X' then Buffer2:=73 else if buffer='Y' then Buffer2:=74 else if buffer='Z' then Buffer2:=75 else
buffer2:=0;
Buffer2:=(buffer2 * Zufall2) + Zufall1;
Geheimcodeform.GeheimcodeText.Text:=Geheimcodeform.GeheimcodeText.Text + inttostr(Zufall1) + ';' + inttostr(buffer2) + ':' + inttostr(Zufall2) + '|';
end;
end;
und hier dann die Umkonvertierung vom zaahlenstring zurück in Buchstaben:
Code:
procedure TGeheimcodeForm.BitButtonEntschluesselnClick(Sender: TObject);
var
numbers: TIntegerDynArray;
i,i2: Integer;
s: TStrings;
x, buffer2: string;
Zahl1, Zahl2, Zahl3: integer;
Zahl1count, Zahl2count, Zahl3count, buffer: integer;
begin
Form2.OriginalText.Text:='';
x:=GeheimcodeText.Text;
ExtractNumbers(x, numbers);
s := TStringList.Create;
for i := Low(numbers) to High(numbers) do
s.Add(IntToStr(numbers[i]));
showmessage(s.Text);
s.Free;
Zahl1count:=0; Zahl2count:=1; Zahl3count:=2;
for i2:=1 to Length(numbers) do begin
Zahl1:=numbers[Zahl1count];
Zahl2:=numbers[Zahl2count];
Zahl3:=numbers[zahl3count];
buffer:=trunc((Zahl2 - Zahl1)/ Zahl3);
//Konvervierungstabelle
if buffer=1 then Buffer2:='a' else if buffer=2 then Buffer2:='b' else if buffer=3 then Buffer2:='c' else
if buffer=4 then Buffer2:='d' else if buffer=5 then Buffer2:='e' else if buffer=6 then Buffer2:='f' else
if buffer=7 then Buffer2:='g' else if buffer=8 then Buffer2:='h' else if buffer=9 then Buffer2:='i' else
if buffer=10 then Buffer2:='j' else if buffer=11 then Buffer2:='k' else if buffer=12 then buffer2:='l' else
if buffer=13 then Buffer2:='m' else if buffer=14 then Buffer2:='n' else if buffer=15 then buffer2:='o' else
if buffer=16 then Buffer2:='p' else if buffer=17 then Buffer2:='q' else if buffer=18 then Buffer2:='<' else
if buffer=19 then Buffer2:='r' else if buffer=20 then Buffer2:='s' else if buffer=21 then Buffer2:='t' else
if buffer=22 then Buffer2:='u' else if buffer=23 then Buffer2:='v' else if buffer=24 then Buffer2:='w' else
if buffer=25 then Buffer2:='x' else if buffer=26 then Buffer2:='y' else if buffer=27 then Buffer2:='z' else
if buffer=28 then Buffer2:='!' else if buffer=29 then Buffer2:='"' else if buffer=30 then Buffer2:='§' else
if buffer=31 then Buffer2:='$' else if buffer=32 then Buffer2:='%' else if buffer=33 then Buffer2:='&' else
if buffer=34 then Buffer2:='/' else if buffer=35 then Buffer2:='(' else if buffer=36 then Buffer2:=')' else
if buffer=37 then Buffer2:='=' else if buffer=38 then Buffer2:='?' else if buffer=39 then Buffer2:='*' else
if buffer=40 then Buffer2:='+' else if buffer=41 then Buffer2:='#' else if buffer=42 then Buffer2:='-' else
if buffer=43 then Buffer2:='_' else if buffer=44 then Buffer2:=':' else if buffer=45 then Buffer2:='.' else
if buffer=46 then Buffer2:=',' else if buffer=47 then Buffer2:=';' else if buffer=48 then Buffer2:=' ' else
if buffer=49 then Buffer2:='A' else if buffer=50 then Buffer2:='B' else if buffer=51 then Buffer2:='C' else
if buffer=52 then Buffer2:='D' else if buffer=53 then Buffer2:='E' else if buffer=54 then Buffer2:='F' else
if buffer=55 then Buffer2:='G' else if buffer=56 then Buffer2:='H' else if buffer=57 then Buffer2:='I' else
if buffer=58 then Buffer2:='J' else if buffer=59 then Buffer2:='K' else if buffer=60 then buffer2:='L' else
if buffer=61 then Buffer2:='M' else if buffer=62 then Buffer2:='N' else if buffer=63 then buffer2:='O' else
if buffer=64 then Buffer2:='P' else if buffer=65 then Buffer2:='Q' else if buffer=66 then Buffer2:='>' else
if buffer=67 then Buffer2:='R' else if buffer=68 then Buffer2:='S' else if buffer=69 then Buffer2:='T' else
if buffer=70 then Buffer2:='U' else if buffer=71 then Buffer2:='V' else if buffer=72 then Buffer2:='W' else
if buffer=73 then Buffer2:='X' else if buffer=74 then Buffer2:='Y' else if buffer=75 then Buffer2:='Z' else
buffer2:='?';
Form2.OriginalText.Text:= Form2.OriginalText.Text + Buffer2;
Zahl1count:= Zahl1count+3;
Zahl2count:= Zahl2count+3;
Zahl3count:= Zahl3count+3;
end;
end;