如何在 Inno Setup 中设置动态密码? [英] How to do a dynamic password in Inno Setup?

查看:36
本文介绍了如何在 Inno Setup 中设置动态密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 always be a same.

有可能吗?

您还有其他建议吗?

感谢您的提前!

推荐答案

使用 CheckPassword 事件函数 而不是 密码指令.

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 none our of %d hashes', [GetArrayLength(Passwords)]));
  Result := False;
end;

这篇关于如何在 Inno Setup 中设置动态密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆