ITPub博客

首页 > 应用开发 > IT综合 > 有关字符的加密与解密 (转)

有关字符的加密与解密 (转)

原创 IT综合 作者:a400 时间:2007-08-12 18:48:54 0 删除 编辑
有关字符的加密与解密 (转)[@more@]

  本人在日常的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;


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10790690/viewspace-951323/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    826
  • 访问量
    304909