abcript.pas

来自「1. It is located in the root directory -」· PAS 代码 · 共 46 行

PAS
46
字号
unit abCript;

interface

type
  TCripter = class
    class function Cript(s: string): string;
    class function Decript(s: string): string;
  end;



implementation

const
  sKey: string = 'x542345691hspwmx';

class function TCripter.Cript(s: string): string;
var
  i: integer;
begin
  Result := '';
  for i := 1 to length(s) do
    s[i] := chr((ord(s[i]) + ord(sKey[i mod length(sKey)])) mod 256);
  Result := s;
end;

class function TCripter.Decript(s: string): string;
var
  i: integer;
  i1: integer;
begin
  Result := '';
  for i := 1 to length(s) do
  begin
    i1 := ord(s[i]) - ord(sKey[i mod length(sKey)]);
    if  i1 < 0 then
      inc(i1, 256);
    s[i] := chr(i1);
  end;
  Result := s;
end;


end.

⌨️ 快捷键说明

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