📄 ucrypt.pas
字号:
unit uCrypt;
interface
const
C1 = 52845;
C2 = 22719;
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: byte;
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(Result[I]) + Key) * C1 + C2;
end;
end;
function Decrypt(const S: string; Key: Word): string;
var
I: byte;
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) * C1 + C2;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -