Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SF Coders] Password Generator
#1
[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
[Image: cooldude.png]

(09-05-2011, 08:36 AM)Orgy Wrote: If you understand what you're doing, you aren't learning anything. ;)
Reply


Messages In This Thread
[SF Coders] Password Generator - by ★Cooldude★ - 12-06-2011, 10:09 AM
RE: [SF Coders] Password Generator - by ThePrinCe - 12-06-2011, 10:47 AM
RE: [SF Coders] Password Generator - by BreShiE - 12-06-2011, 11:31 AM
RE: [SF Coders] Password Generator - by milopeach - 12-09-2011, 02:32 AM
RE: [SF Coders] Password Generator - by oNeiL - 03-19-2012, 03:39 AM
RE: [SF Coders] Password Generator - by Existence - 03-19-2012, 02:14 PM
RE: [SF Coders] Password Generator - by Existence - 03-19-2012, 05:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  SF Coders - Icon Changer - Project 1 Arron XR 14 4,516 09-11-2012, 08:20 PM
Last Post: malis2007
  [SF Coders]Imageshack.Us Image Scraper ★Cooldude★ 7 3,199 08-28-2012, 01:47 AM
Last Post: ★Cooldude★
  Adf.ly Direct Links Generator euverve 6 4,833 06-27-2012, 04:05 AM
Last Post: Ch4ng3m3
  [SF Coders] Grabbing an Icon from a File and Saving! [TUT] milopeach 13 3,806 05-15-2012, 06:22 PM
Last Post: OnyxDev
  [SF Coders] Converting between SteamID's and Friend Profile ID's milopeach 5 2,286 02-04-2012, 04:19 PM
Last Post: Denny Crane

Forum Jump:


Users browsing this thread: 4 Guest(s)