给个最原始的
取反运算
//加密INI文件
procedure EncryptIni;
var
FFS: TFileStream;
FMS: TMemoryStream;
i: Integer;
FContentArray: Array[0..10240] of Byte;
begin
if FileExists(ExtractFilePath(Application.ExeName) + 'bin/dealcnfg.ini') then
begin
FFS := TFileStream.Create(ExtractFilePath(Application.ExeName)
+ 'bin/dealcnfg.ini', fmOpenRead);
FFS.Position := 0;
FFS.Read(FContentArray, FFS.Size);
for i := 0 to FFS.Size-1 do
FContentArray := Not FContentArray;
FMS := TMemoryStream.Create;
FMS.Write(FContentArray, FFS.Size);
FMS.SaveToFile(ExtractFilePath(Application.ExeName) + 'bin/dealcnfg.bin');
FMS.Clear;
FMS.Free;
FFS.Free;
DeleteFile(ExtractFilePath(Application.ExeName) + 'bin/dealcnfg.ini');
end;
end;
//解密INI文件
procedure UnEncryptIni;
var
FFS: TFileStream;
FMS: TMemoryStream;
i: Integer;
FContentArray: Array[0..10240] of Byte;
begin
if FileExists(ExtractFilePath(Application.ExeName) + 'bin/dealcnfg.bin') then
begin
FFS := TFileStream.Create(ExtractFilePath(Application.ExeName)
+ 'bin/dealcnfg.bin', fmOpenRead);
FFS.Position := 0;
FFS.Read(FContentArray, FFS.Size);
for i := 0 to FFS.Size-1 do
FContentArray := Not FContentArray;
FMS := TMemoryStream.Create;
FMS.Write(FContentArray, FFS.Size);
FMS.SaveToFile(ExtractFilePath(Application.ExeName) + 'bin/dealcnfg.ini');
FMS.Free;
FFS.Free;
end;
end;