If you're a webmaster or system administrator, you may need to create many unique passwords. In this article, you'll learn what a good password is and how to generate random passwords with a few simple lines of Java Script code.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Java Script Random Password Generator

Sometimes it's difficult to think of a unique password for every Web site that requires one. And if you're a webmaster or system administrator, you may need to create many unique passwords. In this article, you'll learn what a good password is and how to generate random passwords with a few simple lines of Java Script code.

A good password meets the following requirements:

1. It's long. The longer the better. 2. It can't be found in the dictionary. 4. It is not a proper noun (The name of a person, place, or thing). 5. It contains upper and lower case characters. 6. It contains alpha and numeric characters.

A password cracker is a program used by hackers that generates a continuous sequence of passwords until it finds the one that works. Some hackers have nothing better to do with their time than spend days, even years, running a password cracker on specific websites.

A password cracker starts out by trying every word in the dictionary. If none of them work, it will try every known proper name. Next, it will try every possible arrangement of alpha characters. Then it will try every possible arrangement of alpha and numeric characters.

So, if you have a long password that consists of random alpha and numeric characters, a hacker is going to dedicate a long period of their life trying to hack into your account.

- Note: One thing that makes the hackers life more difficult is security systems that allow only a limited number of tries (sometimes as few as three) to enter a valid password before the username is locked out. The lockout period may be from five minutes to an hour or longer.

So, it's critical that you create a good password. Unfortunately, some websites limit the number of characters that you can use in your password (some as little as eight characters).

In this article, I'm going to provide you with two examples of Java Script random password generators. The first one generates human friendly two syllable pseudo-words. The second one generates any length secure random passwords. The code for the first example is shown below.

<html>
<body>
<script language="JavaScript">

var strChunk = new Array("cane","gain","leaf","lean",
"lech","book","prim","rose","roto","rote","sift","side",
"spur","time","tint","tire","mess","will","wave","weak",
"year","yard","wick","wild","view","lock","tent","sold",
"slab","sent")

function randPassword()
{
  document.write(strChunk[Math.round(Math.random() *
    strChunk.length)] + 
  strChunk[Math.round(Math.random() * strChunk.length)]);
}
</script>

<input type="button" value="Make Password"
  onclick="randPassword();">

</body>
</html>

When you click on the "Make Password" button, it executes the "randPassword()" function. The "randPassword()" function uses the Java Script Math.random() and Math.round() functions to create two random integers. The random integers are used as indexes into the strChunk array. The array contains a list of four character words.

Note: To get more security passwords you should add many more four character words to the array.

You might think the passwords this example creates are not the most secure in the world, and you would be right. However, even though the four character words ARE in the dictionary, the concatenation of any two of them is not. If the resulting eight-character password does turn out to be a dictionary word, just click on the button to get another choice.

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Slide Show Code
Easy Slide Show Code with Mouseover Pause
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Java Script Timer Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Expanding Menu Code
Web Designer's Reference
Object-Oriented JavaScript
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Code for Java Script Cube⁄Box Volume Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Disable IE8 Accelerators on Your Website
Prevent Automated Form Submissions With Java Script
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using the JavaScript Cookie Method
Password Protection Using the Frames Method
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Java Script Comparison Operators
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
Java Script Trim Function
Convert Mixed Number to Decimal
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV


[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2009 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269