C1 and C2 do not look to be defined in the body of the function. Can you 
investigate this path?

Horia



--------------------------------------------------------------------------------
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
petesouthwest
Sent: Friday, January 13, 2006 12:13 PM
To: [email protected]
Subject: [delphi-en] Problem with out of range error


Hi

I thought I had successfully added some code I found to
encrypt/decrypt a string into my project.
I found the code in several places and it appeared that most people
thought it worked. It had been written by someone in TeamB too. 

However, although it worked fine when i first added and compiled my
application, it seems to have developed an odd error with this function:
function InternalEncrypt(const S: AnsiString; Key: Word): AnsiString;
var
  I: Word;
  Seed: Word;
begin
  Result := S;
  Seed := Key;
  for I := 1 to Length(Result) do
  begin
    Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
    Seed := (Byte(Result[I]) + Seed) * Word(C1) + Word(C2)
  end
end;

..........


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to