Forum
Notifications
Clear all
Topic starter
Another free script from Xhanch Studio which is a very flexible and powerful password generator script written in JavaScript. With this password generator, you will not be bother or confuse to choose/select a strong and secure passwords for your important accounts. You can save this script locally so you can use it anytime.
This script can be run well using Mozilla Firefox (any version), Internet Explorer (any version), Opera and Fast Browser.
<html>
<head>
<title>Javascript Password Generator</title>
<script language="JavaScript">
// By : Xhanch Studio
// URL : http://xhanch.com
function gen_numb(min, max){
return (Math.floor(Math.random() * (max - min)) min);
}
function gen_chr(num, lwr, upr, oth, ext){
var num_chr = "0123456789";
var lwr_chr = "abcdefghijklmnopqrstuvwxyz";
var upr_chr = lwr_chr.toUpperCase();
var oth_chr = "`~!@#$%^&*()-_= [{]}|;:'",<.>/? ";
var sel_chr = ext;
if(num == true)
sel_chr = num_chr;
if(lwr == true)
sel_chr = lwr_chr;
if(upr == true)
sel_chr = upr_chr;
if(oth == true)
sel_chr = oth_chr;
return sel_chr.charAt(gen_numb(0, sel_chr.length));
}
function gen_pass(len, ext, bgn_num, bgn_lwr, bgn_upr, bgn_oth,
flw_num, flw_lwr, flw_upr, flw_oth){
var res = "";
if(len > 0){
res = gen_chr(bgn_num, bgn_lwr, bgn_upr, bgn_oth, ext);
for(var i=1;i<len;i )
res = gen_chr(flw_num, flw_lwr, flw_upr, flw_oth, ext);
return res;
}
}
function process(){
pass.value = gen_pass(
len.value,
ext.value,
bgn_num.checked,
bgn_lwr.checked,
bgn_upr.checked,
bgn_oth.checked,
flw_num.checked,
flw_lwr.checked,
flw_upr.checked,
flw_oth.checked
);
}
</script>
</head>
<body>
First character can be:
<input type="checkbox" id="bgn_num" checked="checked">A Number
<input type="checkbox" id="bgn_lwr" checked="checked">An lowercase letter
<input type="checkbox" id="bgn_upr" checked="checked">An uppercase letter
<input type="checkbox" id="bgn_oth" checked="checked">Other
The following characters can be:
<input type="checkbox" id="flw_num" checked="checked">A Number
<input type="checkbox" id="flw_lwr" checked="checked">An lowercase letter
<input type="checkbox" id="flw_upr" checked="checked">An uppercase letter
<input type="checkbox" id="flw_oth" checked="checked">Other
Password length: <input id="len" value="10" style="width:100">
Extra password characters: <input id="ext" style="width:200">
<input type="button" value="Generate" onclick="process()">
Generated password: <input id="pass" style="width:200">
</body>
</html>
Demo: http://xhanch.com/javascript-password-generator/
Source: http://xhanch.com/javascript-password-generator/
Posted : 02/03/2011 11:57 pm