Question Locked

How To: Generate password containing specific pattern

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I am currently trying to create a .hta application to generate random passwords containing three random upper case letters followed by three random numbers. e.g. ABC123.

I done a bit of looking around with google and found the below code and tried to modify it for my needs however I need to be able to make sure the letters always come before the numbers. Currently I'm only able to make it generate a random password which sometimes does not even include any numbers.

I am still fairly new to VBScript and HTA. Could someone advise on how I can make this generate passwords of the format I need.

Code
------


Password Generator






3 replies

by tobif

Hello,
My favourite browser (Opera) went totally crazy on your post. It was impossible to write a reply. Had to fire up IE in order to not have a jumping page constantly reloading.

The reason is, of course, will keep some html etc from your post. That's nice when you want to enter some bold text etc, but makes it very hard to publish pieces of javascript and html.

I'd suggest you hang your code somwhere else (perhaps as a txt file) and give a link here.

by tony hopkinson

then just generate three letters, then three numbers and just bolt them together.

This would be a lot easier if youi wrote a function that returned random one character out of a passed string then called it until you met the length requirement.
You could kill repeats then as well if you wanted simply by removing chosen characters from the input.

Another way is to create an array of valid characters, shuffle them the pick one position and take the next n from there.

This discussion is closed to new replies.