How to do a dynamic password in Inno Setup?

前端 未结 1 756
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 17:21

I want to know how can to create a password that rotate in Inno Setup?
Something similar to a \"Token\"?
Or search in a SharePoint list?
I don\'t want that alway

相关标签:
1条回答
  • 2021-01-03 17:51

    Use CheckPassword event function instead of Password directive.

    [Code]
    
    { Passwords cache in case their retrieval is time consuming }
    var
      Passwords: array of string;
    
    function CheckPassword(Password: String): Boolean;
    var
      Index: Integer;
      SHA1: string;
    begin
      { CheckPassword may be called before any other code (including InitializeSetup), }
      { so any initialization has to happen in the function itself. }
      if GetArrayLength(Passwords) = 0 then
      begin
        Log('Initializing hashes');
        SetArrayLength(Passwords, 5);
        Passwords[0] := 'df65784979efcda967c88de7098a5a106101064e';
        Passwords[1] := 'b78baf5db4b1498ed075b8e6accd0b5ff51e20ec';
        Passwords[2] := 'aaf70585b9a2662c911392b7573c739cecea0e56';
        Passwords[3] := '3ab4222e2d0000012e6c7381437178fab398e8aa';
        Passwords[4] := '5473ccc879a8167a6a77b387a916f7c9ca05894f';
      end;
    
      Index := 0;
      SHA1 := GetSHA1OfUnicodeString(Password);
      for Index := 0 to GetArrayLength(Passwords) - 1 do
      begin
        if SHA1 = Passwords[Index] then
        begin
          Log(Format('Password matches hash %d', [Index]));
          Result := True;
          Exit;
        end;
      end;
    
      Log(Format('Password matches nothing our of %d hashes', [GetArrayLength(Passwords)]));
      Result := False;
    end;
    
    0 讨论(0)
提交回复
热议问题