以下程序可直接用,拷贝就可以了,希望可以起到抛砖引玉的作用。
function StrDecrypt(s: string; key: word): string;
vari:byte;
const
fc1=2;
fc2=3;
begin
//result[0]:=s[0];
setlength(result,length(s));
for i:=1 to length(s) do
begin
result[i]:=char(byte(s[i])xor (key shr 8));
key:=(byte(result[i])+key)*fc1+fc2;
end;
end;
function StrEncrypt(s: string; key: word): string;
var
i:byte;
const
fc1=2;
fc2=3;
begin
setlength(result,length(s));
for i:=1 to length(s) do begin
result[i]:=char(byte(s[i])xor(key shr 8));
key:=(byte(s[i])+key)*fc1+fc2;
end;
end;
function CheckPassWord(Pass:string):String;
Var
Itm : Array [0..12