Support Forums
[SF Coders] Password Generator - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [SF Coders] Password Generator (/showthread.php?tid=23624)

Pages: 1 2 3


[SF Coders] Password Generator - ★Cooldude★ - 12-06-2011

[Image: YzwzC.png]

Code:
Function GeneratePassword(Byval Length)
If (Length < 5) Then
            Length = 5 'Do not allow a password of length less than 5
        End If
        Dim alphabet As String() = Split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z", ",") 'Declare Our Alphabet
        Dim numbers As String() = Split("0,1,2,3,4,5,6,7,8,9", ",") 'Declare our numbers
        Dim Symbols As String() = Split("!,£,$,%,^,&,*,(,),{,},~,@,:,;,#,?,/,>,.,<", ",") 'Declare our symbols
        Dim Rand As New Random 'Declare our random
        Dim Password As String = "" ''Decalre our password as an empty string

        While (Password.Length() < length)
            If (Password.Length() = (length - 1)) Then
                Password += Symbols((Rand.Next(0, UBound(Symbols))))
            ElseIf Password.Length() >= (length - 3) Then
                Password += numbers(Rand.Next(0, UBound(numbers)))
            Else
                Password += alphabet(Rand.Next(0, UBound(alphabet)))
            End If
        End While
        Return Password
    End Function

After making the PHP version of this password generator (Which can be found here) I decided that I wanted to create a VB.Net version.

Usage:

PHP Code:
GeneratePassword(Length

Example:

PHP Code:
GeneratePassword(15

Output: xBUFaMJOtoTK45(

Enjoy. Smile


RE: [SF Coders] Password Generator - ThePrinCe - 12-06-2011

Thanks for the share Dude , will take a look a it when i get time.


RE: [SF Coders] Password Generator - FizzyMentos - 12-06-2011

nice man Smile looks good, I may even use it in my custom password checker control if thats cool with you?
(and i can actually be bothered to update my control) lol, You will get credits of course Tongue


RE: [SF Coders] Password Generator - BreShiE - 12-06-2011

Did this get re-posted?

Anyway well done for your first project, nice a cleanly done. Smile


RE: [SF Coders] Password Generator - ★Cooldude★ - 12-06-2011

(12-06-2011, 11:30 AM)TrinityCoder Wrote: nice man Smile looks good, I may even use it in my custom password checker control if thats cool with you?
(and i can actually be bothered to update my control) lol, You will get credits of course Tongue

Sure thing. Smile

(12-06-2011, 11:31 AM)BreShiE Wrote: Did this get re-posted?

Anyway well done for your first project, nice a cleanly done. Smile

This is a VB.Net version. Tongue Smile


RE: [SF Coders] Password Generator - milopeach - 12-09-2011

Here is my version, uses random characters and a Select Case to make the password as random as possible.

I made it because most use the string array and it;s easier to use ASCII codes. You can also replace the whole Select Case and IF statements with a
PHP Code:
_Password += Chr(Random.Next(33126)) 
Which will give you a bit of everything if you don't want to make it selectable.

Function:

Usage:
PHP Code:
Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        TextBox1
.Text GeneratePassword(NumericUpDown1.Value)
    
End Sub 

Screenshot:
[Image: ?h=181ef61e312f744e140e95785704f7ea]


RE: [SF Coders] Password Generator - Denny Crane - 02-04-2012

Could i add more symbols and stuff? or will that make the password unusable on some websites...?


RE: [SF Coders] Password Generator - AceInfinity - 02-04-2012

(02-04-2012, 04:27 PM)Warp 1.9 Wrote: Could i add more symbols and stuff? or will that make the password unusable on some websites...?

I'm pretty sure this is just logical common sense, but it's up to you which symbols you want to use. You'd just be chancing it for which websites would allow certain symbols as password chars that's all. Otherwise, usually websites allow you free will over what kind of complex password you want.


RE: [SF Coders] Password Generator - Denny Crane - 02-04-2012

(02-04-2012, 06:22 PM)AceInfinity Wrote: I'm pretty sure this is just logical common sense, but it's up to you which symbols you want to use. You'd just be chancing it for which websites would allow certain symbols as password chars that's all. Otherwise, usually websites allow you free will over what kind of complex password you want.
What if i wanted it to spell a certain word in there somewhere but generate random characters around it?


RE: [SF Coders] Password Generator - AceInfinity - 02-04-2012

(02-04-2012, 07:39 PM)Warp 1.9 Wrote: What if i wanted it to spell a certain word in there somewhere but generate random characters around it?

Again, I would say exactly what i've just said.
Ace Wrote:I'm pretty sure this is just logical common sense, but it's up to you which symbols you want to use. You'd just be chancing it for which websites would allow certain symbols as password chars that's all. Otherwise, usually websites allow you free will over what kind of complex password you want.

That's simply just common sense.