Generating a random hash value and password

Hello,

Suppose I have built a setup for my program in FinalBuilder with the following file name:

myprogram-1.0-setup.exe

Now I would like to embed this setup into password protected RAR archive and modify the resulting RAR file name to contain a random (hash?) value in itself.

myprogram-1.0-setup-randomhashvalue.rar

where randomhashvalue would be different in every build, so that every build produces a RAR archive with a different file name. This is needed because I want to put this file on our web server - it has directory listing already disabled and I want this file name to be hard to guess for anyone out there (unauthorized access). I know how to create a password protected RAR archive and rename it in FinalBuilder. I just don't know how to generate a random has value and random password for the RAR archive in FinalBuilder. So I have the following 2 questions:

  1. Regarding the random hash value used for the file name, I thought about using something like MD5 and calculate the hash value against the setup executable itself. This will give me 16 bytes long hash value that I can embed into the file name. Is there a way I can do that from within FinalBuider? Or is there a better way to do that?
  2. I have absolutely no clue how to generate a random (but strong) password for the RAR archive. Does anyone know if it is possible to do that in FinalBuilder as well?

Thank you in advance!

Hi Ivo,

1. You can use the 'Calculate File MD5' to generate the hash of the installer and then the 'Rename File or Directory' to rename the file.

2. The easiest way (but not as strong) would be to use the 'Generate Random Number' action to generate a number and use that as the password, if you require a stronger password then you can use the 'Run Script' action to execute the script below:

var passwordLength = 10; 
var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
var password = "";

for(i = 0; i <= passwordLength; i++) {
password += chars.charAt(Math.floor(Math.random() * chars.length));
}

[your_variable] = password;

 



You'll need to replace [your_variable] with the name of the FinalBuilder variable where you want the password to be stored.


Regards,
Paul.

Hi Paul,

 

Thanks for the suggestions. I will give it a go as soon as I have some time and will get back here if I encounter any problems.

Ivo