Hello Steve!
begin
CharByte:=FBuffer[x];
if (CharByte0) or (CharByte32) then
begin
CharByte:=CharByte xor Ord(Key[Ctr]);
FBuffer[x]:=CharByte;
end;
If (CharByte=0) or (CharByte=32) then CharByte:=CharByte xor Ord(Key[Ctr]);
If Ctr>KeyLen then Ctr:=0;
Application.ProcessMessages;
end;
PROBABLY you've missed to INC(ctr) somewhere in your code, but if that is not
the case, read on..
I need more information; how are the following variables declared:
FBuffer, charbyte, Ctr
Also, why the IF (charbyte0 or 32) etc it is meaningless in the code above
you do the same thing weather there is a #0 or #32 or #anychar. I guess that
along the way you discovered that it was kind of hard DEcrypting when you
found the value #32 and you did not know weather this was a real space or if
it was another char to be decrypted ;-)
why don't you do something like this:
const maxbufsize=8192
type TCharBuffer=ARRAY[1..maxbufsize] of char;
procedure cryptbuffer(s:TCharBuffer,key:String);
var
x:Longint;
keypos:Byte;
begin
x:=1;
keypos:=length(key);
while (s[x]#0) and (x<=maxbufsize) do begin
s[x]:=chr(ord(s[x]) xor ord(key[keypos]));
inc(x);
dec(keypos);
if keypos=0 then begin
keypos:=length(key);
application.processmessages;
end;
end;
end;
cheers,
andreas
andreas
--- GEcho 1.20/Pro
---------------
* Origin: Lead me not into temptation. I can find it myself. (2:200/407)
|