1.delphiԴ?源码智慧农业项目源码????
delphiԴ?????
加密/解密一个字符串
{ Begin code }
program Crypt;
uses WinCRT;
const
C1 = ;
C2 = ;
function Encrypt(const S: String; Key: Word): String;
var
I: byte;
begin
Result[0] := S[0];
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
Result[0] := S[0];
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;
var
S: string;
begin
Write('>');
ReadLn(S);
S := Encrypt(S,);
WriteLn(S);
S := Decrypt(S,);
WriteLn(S);
end.
2024-12-27 13:34
2024-12-27 13:29
2024-12-27 13:15
2024-12-27 13:01
2024-12-27 13:00
2024-12-27 12:36
2024-12-27 12:05
2024-12-27 11:56