Top

.NET Password Generator


.NET Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Oct 06, 2009
Last Updated  Oct 06, 2009
Tags  .net  44  generator  jonesy  jonesy44  password 

Introduction

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.

Grab the Code

'*****
'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

  (5)  RSS
jonesy44
Comments: 1,856
 
.NET Snippet:  .NET Password Generator
Posted on Oct 6, 2009 4:53 pm
Stole this from the mirc discussion haha!!
sunslayer
Comments: 267
 
.NET Snippet:  .NET Password Generator
Posted on Oct 6, 2009 8:10 pm
successful ripper is successful L
Jethro_
Comments: 438
 
.NET Snippet:  .NET Password Generator
Posted on Oct 7, 2009 12:16 am
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.
sunslayer
Comments: 267
 
.NET Snippet:  .NET Password Generator
Posted on Oct 7, 2009 5:22 am
jonesy44
Comments: 1,856
 
.NET Snippet:  .NET Password Generator
Posted on Oct 7, 2009 4:54 pm
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:)

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom