Reputation: 49
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.
Is it possible?
Do you have other suggestion?
Thanks for advance!
Upvotes: 1
Views: 2177
Reputation: 202360
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
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;
Upvotes: 1