Site hosted by Angelfire.com: Build your free website today!
 
MyersDaily Directories
Message Board | Lycos | JavaScripts.com
Your Pages | What's Up | Contents | Bottom of Page
[Home][Archive]

Copy-and-Paste Password Function


<script language="javascript1.1">

<!--
// Script by Joseph K. Myers <e_mayilme@hotmail.com>, <https://www.angelfire.com/yt/jmyers/>.


// This script produces a password with a length equal to the argument passed to createPassword().
// The chances of "guessing" a password of eight characters are 1 in 3,521,614,606,208.

// Use this formula 62! / (62 - ( argument of createPassword() )!.
// i.e. createPassword(3) level of strength = 62 times 62 times 62.


var textString = 'abcdefghijklmnopqrstuvwxyz0123456789';

function createPassword(argLen) {

if (!argLen || argLen > 1000 || argLen < 1 || isNaN(argLen)) {
  alert('Error of type -362 occurred.\n\nArgument '+ unescape("%D2argLen%D3") + " given invalid radii.");
  return (isNaN(argLen)) ? 'non-numeric argument' : 'bad numeric identity';
}

var aHardThing = '';

while (aHardThing.length < argLen) {
  var randChar = textString.charAt(   Math.floor(Math.random() * textString.length)   );
  aHardThing += (Math.random() < .5) ? randChar.toUpperCase() : randChar;
  
} return aHardThing;


}

//-->

</script>

Demonstration of function:

Automatic (8 characters):
Custom (specify):
 
Enter keywords...  
Amazon.com logo Featured! | Send to a friend!
Home | Top | Feedback | Site Index | Best Photo
“MyersDaily” created by Joseph K. Myers 1999-2000. Free hosting by Angelfire!!
Note: This site's URL is: https://www.angelfire.com/yt/jmyers   Site Updated On: October 6, 2000
Terms-of-Service