【问题标题】:How to do a dynamic password in Inno Setup?如何在 Inno Setup 中设置动态密码?
【发布时间】:2021-03-01 14:44:46
【问题描述】:

我想知道如何创建在 Inno Setup 中轮换的密码?
类似于“令牌”的东西?
或者在 SharePoint 列表中搜索?
我不希望它总是一样的。

有可能吗?

您还有其他建议吗?

感谢您的提前!

【问题讨论】:

    标签: installation passwords inno-setup


    【解决方案1】:

    使用CheckPassword event function 而不是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 none our of %d hashes', [GetArrayLength(Passwords)]));
      Result := False;
    end;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-13
      • 1970-01-01
      • 2022-08-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多