Computing.Net > Forums > Web Development > online password generator

online password generator

Reply to Message Icon

Original Message
Name: olidav911
Date: November 16, 2006 at 06:12:13 Pacific
Subject: online password generator
OS: N/A
CPU/Ram: N/A
Model/Manufacturer: N/A
Comment:

I would like to create a password generator using javascript or something but how do I do this because I want to create a password that is 6 digits long, and it needs to be 3 letters followed by three number, i.e "abc123". Any help would be greatly appreciated!


Report Offensive Message For Removal

Response Number 1
Name: Michael J (by mjdamato)
Date: November 16, 2006 at 10:44:57 Pacific
Subject: online password generator
Reply: (edit)

Do you want upper and lowercase letter or just one of them?

Michael J


Report Offensive Follow Up For Removal

Response Number 2
Name: Michael J (by mjdamato)
Date: November 16, 2006 at 11:00:00 Pacific
Subject: online password generator
Reply: (edit)

Upper case letters only:

function generatePassword() {

a1 = Math.floor(Math.random()*26+65);
a2 = Math.floor(Math.random()*26+65);
a3 = Math.floor(Math.random()*26+65);
n1 = Math.floor(Math.random()*10+48);
n2 = Math.floor(Math.random()*10+48);
n3 = Math.floor(Math.random()*10+48);

password = String.fromCharCode(a1,a2,a3,n1,n2,n3);
return password;
}


Lower case letters only:

function generatePassword() {

a1 = Math.floor(Math.random()*26+97);
a2 = Math.floor(Math.random()*26+97);
a3 = Math.floor(Math.random()*26+97);
n1 = Math.floor(Math.random()*10+48);
n2 = Math.floor(Math.random()*10+48);
n3 = Math.floor(Math.random()*10+48);

password = String.fromCharCode(a1,a2,a3,n1,n2,n3);
return password;
}


Upper and lower case letters:

function generatePassword() {

a1 = Math.floor(Math.random()*52+65);
a1 = (a1 > 90) ? a1 + 6 : a1;
a2 = Math.floor(Math.random()*52+65);
a2 = (a2 > 90) ? a2 + 6 : a2;
a3 = Math.floor(Math.random()*52+65);
a3 = (a3 > 90) ? a3 + 6 : a3;
n1 = Math.floor(Math.random()*10+48);
n2 = Math.floor(Math.random()*10+48);
n3 = Math.floor(Math.random()*10+48);

password = String.fromCharCode(a1,a2,a3,n1,n2,n3);
return password;
}

Michael J


Report Offensive Follow Up For Removal

Response Number 3
Name: olidav911
Date: November 20, 2006 at 07:01:37 Pacific
Subject: online password generator
Reply: (edit)

Thanks a lot. It was only the lowercase one that I wanted but your help is very much appreciated.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: online password generator

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software