簡(jiǎn)單的加密算法const C1 = 52845; {Used for encryption of Master Password string} C2 = 11719; Key = 1234; 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; 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; |
|
來(lái)自: 逸隨風(fēng)清 > 《Delphi學(xué)習(xí)》