.NET Password Generator

By Jonesy44 on Oct 06, 2009

A Password generator for VB.NET, just load this up as a console application and hit debug.

This is mainly to show/test the Rnd() function.

'*****
'Password Generator
'Jonesy44
'6 Oct 2009
'*****
Module Module1

    Sub Main()
        'declare variables
        Dim length As Integer, pass As String

        'initialize rnd() function
        Randomize()

        'get input values
        System.Console.Write("How long do you want the password to be? ")
        length = System.Console.ReadLine()

        'generate password
        For x As Integer = 1 To length
            If Int(Rnd() * 3) = 0 Then : pass += CStr(Int(Rnd() * 9))
            ElseIf Int(Rnd(0) * 3) = 1 Then : pass += Chr(Int((90 - 65 + 1) * Rnd() + 65))
            Else : pass += Chr(Int((122 - 97 + 1) * Rnd() + 97))
            End If
        Next

        'ouput generated pass
        System.Console.WriteLine("{0}Generated Password {1}", vbCrLf, pass)

        'halt console for user to read output
        System.Console.ReadLine()
    End Sub

End Module

Comments

Sign in to comment.
Jonesy44   -  Oct 07, 2009

Well, i'm learning VB atm for school so any practice i get is great and a pw generator seemed a cooland possible idea for my current knowledge:)

 Respond  
Jethro   -  Oct 07, 2009

Admit it. We all have 'dissected' some codes for learning to script. "Ripping," in a way, is not a bad thing; it's part of the learning process.

 Respond  
sunslayer   -  Oct 06, 2009

successful ripper is successful L

 Respond  
Jonesy44   -  Oct 06, 2009

Stole this from the mirc discussion haha!!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.