Lewisburg, PA "Next year Raiders in the Super Bowl"
Posts
1,310
Random Password Generator
Since I've posted the following class in a different thread, (which has now been moved here), about a way to randomly generate a password I have submitted my code here for everyone to use, tweak and make comments.
Description:
Call one of the overloaded functions and a you will have a randomly generated password.
Generate() - Will generate a password 13 or (more/less) characters in length ranging from A-Z a-z 0-9 and other characters such as @ # %... etc.
Generate(ByVal AsciiMin As Integer, ByVal AsciiMax As Integer)
Generate(ByVal AsciiMin As Char, ByVal AsciiMax As Char) - Allows you to set your ASCII range if you wish not to include number for example.
Generate(ByVal ExcludeValues As String()) - Works like Generate() buts characters passed in the array will not be used to generate the password.
Generate(ByVal AsciiMin As Integer, ByVal AsciiMax As Integer, ByVal ExcludeValues As String())
Generate(ByVal AsciiMin As Char, ByVal AsciiMax As Char, ByVal ExcludeValues As String()) - Works like Generate(ByVal AsciiMin As Integer, ByVal AsciiMax As Integer) & Generate(ByVal AsciiMin As Char, ByVal AsciiMax As Char), but allows you to also exclude characters that you do not wish the generator to use.
UPDATE 03/06/2006: Included use of Phill64's TrueRandom2 class for generating random numbers. Also overloaded the constructor so that a length can be set for the password, if the length is not set the default is set to 13.
please enjoy
Last edited by vbdotnetboy; Mar 6th, 2006 at 03:08 PM.
Derek - Using VS 2008 99% of the time and VS 2003 1% of the time