本人在日常的MIS的开发中常用到的些口令处理中常用的个字符处理过程
现在帖在这里请大家多提意见!
function CryptStr(const S:String; sType: DWord):String;
var
i: Integer;
FKey: Integer;
begin
result:='';
case sType of
0: SetPass;
begin
Randomize;
FKey := Random($FF);
for i:=1 to Length(s) do
Result := Result+Chr( Ord(s[i]) xor i xor FKey);
Result := Result + Char(FKey);
end;
1: GetPass
Begin
FKey := Ord(S[Length(s)]);
for i:=1 to Length(s) - 1 do
Result := Result+Chr( Ord(s[i]) xor i xor FKey);
end;
end;