Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become an Expert!

Join 244,308 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 810 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
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
+Quote Post


lordms12
RE: Random Text/Number Generator - Passord List
19 Aug, 2008 - 06:47 AM
Post #2

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 335



Thanked: 23 times
Dream Kudos: 250
My Contributions
Can someone move this to javascript forum.
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Random Text/Number Generator - Passord List
19 Aug, 2008 - 04:00 PM
Post #3

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 3,813



Thanked: 203 times
Dream Kudos: 1325
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
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 06:58PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month