⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_encrypt.pas

📁 完整的进销存系统。 设计文件及完整的源代码。 Delphi6.0
💻 PAS
字号:
unit u_encrypt;//加密單元

interface

uses
classes;

const
C1:integer=12345;
C2:integer=54321;
//=================
g_pwdkey: Integer=888888;
function Encrypt(const S: string; Key: Word): string;
function Decrypt(const S: string; Key: Word): string;

implementation

function Encrypt(const S: string; Key: Word): string;//加密
var
  I: Integer;
begin
  Result := S;
  for I := 1 to Length(S) do
  begin
    Result[I] := char(byte(S[I]) xor (Key shr 13));
    Key := (byte(Result[I]) + Key) * C1 + C2;
  end;
  if Result='' then
    Result:='ERP';
end;

function Decrypt(const S: string; Key: Word): string;//解密
var
  I: Integer;
begin
  Result := S;
  if Result='ERP' then begin Result:=''; exit; end;
  for I := 1 to Length(S) do
  begin
    Result[I] := char(byte(S[I]) xor (Key shr 13));
    Key := (byte(S[I]) + Key) * C1 + C2;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -