Random Password Generator

Table of Contents

Technologies used -
Description

The Random Password Generator is a straightforward tool for creating secure, unique passwords that combine uppercase and lowercase letters, numbers, and symbols to increase security. Designed for anyone who wants to strengthen their account security, this tool ensures that each generated password is both random and unpredictable, making it resistant to common password-cracking techniques.

Users can simply click the “Generate Password” button, and a strong, 12-character password will instantly appear in the display box. For added convenience, the generator includes a “copy” function, allowing users to quickly copy their new password to their clipboard for easy pasting into account registration or password fields. This tool is a great addition for anyone wanting to improve security without the hassle of manually crafting complex passwords

Highlighted Source Code
				
					const passwordBox  = document.getElementById("password"); 
const length = 12;
const upperCase = "ABCDEFGHIJKLMNOPQRSTUVXYZ";
const lowerCase = "abcdefghijklmnopqrstuvxyz";
const number = "0123456789";
const symbol = "!@#$%^&*()+-?[]{}";
const allChars = upperCase + lowerCase + number + symbol;

function createPassword() {
    let password = "";
    password += upperCase[Math.floor(Math.random() * upperCase.length)];
    password += lowerCase[Math.floor(Math.random() * lowerCase.length)];
    password += number[Math.floor(Math.random() * number.length)];
    password += symbol[Math.floor(Math.random() * symbol.length)];

    while(length > password.length) {
        password += allChars[Math.floor(Math.random() * allChars.length)];
    }
    passwordBox.value = password;
}
				
			

Related Projects

Fun Project

Tic Tac Toe Game

The Interactive Tic Tac Toe Game is a classic two-player game implemented using HTML, CSS, and JavaScript. This engaging application

Read More »