Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,661 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,182 people online right now. Registration is fast and FREE... Join Now!




Random Text/Number Generator - Passord List

 
Reply to this topicStart new topic

Random Text/Number Generator - Passord List, Creating a password list generator that will output 100 unique passwor

westaustin
post 19 Aug, 2008 - 04:44 AM
Post #1


New D.I.C Head

*
Joined: 19 Aug, 2008
Posts: 1

All,

I'm a noob, and have had a Java programming class a while back, but just can't get this, even though it should be an easy fix. I'm trying to set up a password generator that will spit out a list of passwords for me. The only choice I want is whether or not it will be 8 or 15 characters, and the passwords have to have certain characteristics (ex: 2 each of upper case, lower case, number and special characters). I wanted to run it in a simple html page, I am just having a problem with getting the "generate password" button to create multiple passwords to populate a list, and with getting a random password while specifying the minimum characteristics of 2 of each type.....

I've played with numerous different snippets, but this one seems to have the most potential if I could figure out where to go next. I think having several different keylists for the types would work, but how do I make that random (not a capital letter in the 1st position every time...)?

CODE

<html>
<head>
<script>
var keylist="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%^&*()"
var temp=''

function generatepass(plength)
{
temp=''
for (i=0;i<plength;i++)
temp+=keylist.charAt(Math.floor(Math.random()*keylist.length))
return temp
}

function populateform(enterlength)
{
document.pgenerate.output.value=generatepass(enterlength)
}
</script>
</head>
<body>
<form name="pgenerate">
<b>Password Length:</b>
<input type="text" name="thelength" size=3 value="7"><br/>
<input type="text" size=25 name="output">
<input type="button" value="Generate Password"
onClick="populateform(this.form.thelength.value)">
</form>
</body>
</html>
User is offlineProfile CardPM

Go to the top of the page

lordms12
post 19 Aug, 2008 - 06:47 AM
Post #2


D.I.C Regular

Group Icon
Joined: 16 Feb, 2008
Posts: 312



Thanked 13 times

Dream Kudos: 225
My Contributions


Can someone move this to javascript forum.
User is offlineProfile CardPM

Go to the top of the page

BetaWar
post 19 Aug, 2008 - 04:00 PM
Post #3


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,987



Thanked 78 times

Dream Kudos: 1175
My Contributions


I would suggest splitting the keylist into 4 lists (one of lower, upper numeric and special), then as you go through your loop you make sure that you ave the characters done (use some random thing and then have a counter for each of them that checks to make sure you haven't exceeded your limit of characters in the password and makes sure you get all the required characters at least once (or whatever) in the password.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:39AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month