Wednesday, 8 December 2010

Generating random strings with VBScript

How to generate random strings of various lengths for use as a password database in bulk user creation or any other purpose? It is relatively simple task with some VBScript skills. Of course it won’t be really random as VBScript can only generate pseudo-random numbers. That means that if someone will know the random seed and entropy used to generate the passwords it will be possible to reproduce the same set of passwords.

The script which I’m presenting here will generate random number and then use it as an index to the entropy array (i.e. array of all characters which could be used in the password). Number of characters in the password is also random between the PASS_LEN_MIN and PASS_LEN_MAX boundaries (inclusive). To make all passwords the same length, use the same number for PASS_LEN_MIN and PASS_LEN_MAX.

If security is the main concern than this utility shouldn't probably be used. Having said that here are some tips on how to improve passwords quality:
  • expanding entropy  – to add special characters
  • mix entropy – entropy character order could be altered and then removed after the passwords are generated to make the process even less predictable
  • use different seed – in order to make the random number sequence less predictable a user specified seed could be used. This can be done by passing a parameter to the Randomize function:
    Randomize 767554354

    Note: Provided that the script is unchanged using the same seed will always generate the same result file. By default there is no seed value passed to the Randomize function which will use current timestamp.
  • random pick – generate more passwords than required and pick a random subset

By default the script will generate 100 passwords and will save them to the PasswordDictionary.txt file in the script working folder. Running the script from the Desktop will generate password file called PasswordDictionary.txt on the Desktop.

The Random String Generator utility can be downloaded from here.

18 comments:

  1. Great... Excellent sharing.. This is very helpful for beginers. Read that provide me more enthusiastic. This helps me get a more knowledge about this topic. Thanks for this.
    Android Training in Chennai

    ReplyDelete
  2. Awesome blog, really its nice to read and very useful to us... Java Training in Chennai | Dot Net Training in Chennai

    ReplyDelete
  3. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Java Project Center in Chennai | Best Java Projects in Velachery

    ReplyDelete
  4. very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information in this blog....
    Java Training Center in Chennai | Best J2EE Training Center in Chennai | No.1 Java Training Institution in Velachery | Core Java Training in Chennai

    ReplyDelete
  5. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly. 
 Java Training Center in Chennai | Best J2EE Training Center in Chennai | No.1 Java Training Institution in Velachery

    ReplyDelete
  6. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog... 
    Web Designing Training Institute in Chennai | Web Designing Training Institute in Velachery

    ReplyDelete