如何在Inno Setup中设置动态密码?

问题描述 投票:0回答:1

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

可能吗?

您还有其他建议吗?

谢谢您的提前!

installation passwords inno-setup
1个回答
1
投票

使用

CheckPassword
事件函数 而不是
Password
指令

[Code]

// Passwords cache in case their retrieval is time consuming
var
  Passwords: array of string;

function CheckPassword(Password: String): Boolean;
var
  I: Integer;
  SHA1: string;
  Count: Integer;
begin
  // CheckPassword may be called before any other code
  // (including InitializeSetup), so any initialization has to happen
  // in the function itself.
  Count := 5;
  if GetArrayLength(Passwords) = 0 then
  begin
    Log('Initializing hashes');
    SetArrayLength(Passwords, Count);
    Passwords[0] := 'df65784979efcda967c88de7098a5a106101064e';
    Passwords[1] := 'b78baf5db4b1498ed075b8e6accd0b5ff51e20ec';
    Passwords[2] := 'aaf70585b9a2662c911392b7573c739cecea0e56';
    Passwords[3] := '3ab4222e2d0000012e6c7381437178fab398e8aa';
    Passwords[4] := '5473ccc879a8167a6a77b387a916f7c9ca05894f';
  end;

  SHA1 := GetSHA1OfUnicodeString(Password);
  for I := 0 to Count - 1 do
  begin
    if SHA1 = Passwords[I] then
    begin
      Log(Format('Password matches hash %d', [I]));
      Result := True;
      Exit;
    end;
  end;

  Log(Format('Password matches none of our %d hashes', [Count]));
  Result := False;
end;
© www.soinside.com 2019 - 2024. All rights reserved.