下面这段代码在delphi 2009 和delphi 2006运行结果不一样?
function _Encrypt(const S: string): string;
var I: byte; Key: Word;
begin
Key := cKey;
SetLength(result, length(s));
for I := 1 to Length(S) do
begin
Result[I] := Char(byte(S[I]) xor (Key shr 8));
try Key := (byte(Result[I]) + Key) * cKey1 + cKey2; except end;
end;
end;
这段代码为加密算法,因为2009全为Unicode,所以执行结果不一样,string不变为AnsiString怎样改一下能结果一样?