TIP: Click on subject to list as thread! ANSI
echo: delphi
to: STEVE BATSON
from: ANDREAS BIRGERSON
date: 1997-03-09 21:24:00
subject: Works in D1 but not D2

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.