我在xp中运行这个程序,加密后,再解密出现乱码,
而在win98中运行正常,加密和解密正常,没有出现乱码,
这是什么原因呀?????代码如下:function TForm14.Destring(const s: string; key: word): string;
var
i:byte;
begin
result:='';
for i:=1 to length(s) do begin
result:=result+char(byte(s[i]) xor (key shr 8));
key:=(byte(result[i])+key)*52845+22719;
end;end;function TForm14.EnString(const s: string; key: word): string;
var
i:byte;
begin
result:='';
for i:=1 to length(s) do begin
result:=result+char(byte(s[i]) xor (key shr 8));
key:=(byte(s[i])+key)*52845+22719;
end;end;
而在win98中运行正常,加密和解密正常,没有出现乱码,
这是什么原因呀?????代码如下:function TForm14.Destring(const s: string; key: word): string;
var
i:byte;
begin
result:='';
for i:=1 to length(s) do begin
result:=result+char(byte(s[i]) xor (key shr 8));
key:=(byte(result[i])+key)*52845+22719;
end;end;function TForm14.EnString(const s: string; key: word): string;
var
i:byte;
begin
result:='';
for i:=1 to length(s) do begin
result:=result+char(byte(s[i]) xor (key shr 8));
key:=(byte(s[i])+key)*52845+22719;
end;end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货