(English 8k word list)
This web app is not the most secure way to make your password! Traces of the passwords you create can be left behind in your computer's memory, among other risks. Clicking "Save State" will store a 32 byte seed from the RNG state to disk and save your preferred cipher. Using the ChaCha , Spritz , or Trivium stream ciphers with key presses is backtracking resistant such that an adversary should not be able to regenerate prior passwords from it. They also should not be able to predict your keystrokes, so future passwords should be improbable to generate also. But a leaked RNG state could present other risks. For maximum security we still recommend using ordinary dice to select a password or passphrase. See the Diceware page for more details.
PassGen3 awards only 2 bits of entropy per character typed. This is based on Shannon entropy of English text and synchronization between keyboard typing and neural oscillations . There may be more entropy per keystroke, but 2 bits is about as liberal as I dare award and it's enough to generate passwords very quickly. As such, you will be required to type 64 characters on page load to seed the state with at least 128 bits of entropy before passwords begin to appear. PassGen3 does track all entropy, accumulated and used, to make your typing as efficient as possible.
The security margins of each password type are as follows:
Nonetheless, using this web app to generate a password is far safer than picking your pet's name or your mother's birthday. Because JavaScript web apps download from an untrusted web server, there is risk of mischief. This web app does not make any network connections, so you can run it offline after you download it and inspect the source code. People desiring even greater assurance in security can use the dice-based password generation techniques described at https://www.diceware.com .
You should be aware that someone could substitute a bogus version of the web app that creates apparently random passwords that are, in fact, easy for the adversary to guess. To reduce this risk, the source code of the web app is published as open source . The ChaCha, Spritz, and Trivium stream ciphers were also chosen as they are easy to understand and the source code should be easy to read for those moderatly familiar with programming.
Random generation methods will very rarely create a password that is an English word or phrase or simple letter pattern. If a password looks like an ordinary word (or, with the "ASCII" template, is all the same case) simply type some more and use the next password.
PassGen3 uses a strong method for mixing randomness. The first version of PassGen used an entropy distiller with a 64-bit internal state, based on a linear congruential algorithm. PassGen2 used an entropy distiller based on the weak RC4 cipher. PassGen3 allows you to pick from the ChaCha , Spritz , or Trivium stream ciphers as an entropy distiller.
In Spritz , a 256-byte state vector that is initialized to be a null permutation. As Spritz is based on a sponge construction, both the key press time in milliseconds and the character value are absorbed to permute the Spritz state. As such, the Spritz state is highly mixed by each keystroke. Each password output character is then squeezed out of the Spritz state. Published analysis have shown that Spritz can be distinguished from true random white noise. As such, a countermeasure has been added to remove the distinguishers found in the keystream.
In ChaCha , a 64-byte state vector is initialized following RFC 8439 . ChaCha is based on an ARX (add-rotate-xor) cipher that builds a keystream that is XORed with the data. Unlike Spritz, the ChaCha state is not dependent on the data it is encrypting. PassGen3 should provide a consistent API for all ciphers, so an "absorb" and "squeeze" functionality have been added to ChaCha. This is done by maintaining a 64-byte entropy pool to store key presses in milliseconds and their character values. Once the pool is filled, it is used to directly rekey ChaCha.
In Trivium , a 288-bit state vector is initialized to be a null permutation following the specification . Trivium uses three non-linear feedback shift registers in a closed loop. It is optimized for hardware so operates on individual bits instead of bytes like ChaCha and Spritz. Trivium also is not based on a sponge construction, so like ChaCha, "absorb" and "squeeze" functions have been added to keep a consistent API in PassGen3. Also like ChaCha, a 10-byte entropy pool to store key presses in milliseconds and character values is maintained. Once the pool is filled, it is used to directly key Trivium.
When using an 8-bit value to select a character from an alphabet of length "n", there is a risk of bias if "n" does not evenly divide 256. To eliminate this, candidate cipher output bytes are discarded if they are outside of the range that is the largest multiple of "n" less than or equal to 256.
PassGen3 performs extensive absorbing of initialization data via the way of a browser fingerprint and requiring the user to type at least 64 characters when the page is loaded. The key presses are required to key the cipher state with at least 128 bits of keyboard entropy.
PassGen, PassGen2 © 1996, 2003 Arnold G. Reinhold, Cambridge, MA, USA
PassGen3 © 2022 Aaron Toponce
PassGen and PassGen2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
PassGen3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3 as published by the Free Software Foundation, with two additional restrictions:
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. If the previous link does not work, you can request a copy of the license by writing to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA.
In this tutorial, we are going to create a javascript password generator app. This app is going to be customizable and can be used to create any kind of password.
The app will have the following features:
The password created using this app is going to be a very strong password, since it includes all keyword combinations like numbers, symbols, uppercase, and lowercase alphabets and the password is sufficiently long. The password is going to be random and unique so that it is not easy to guess.
Here is a preview of the app:
Password is the first defense against unauthorized access to your accounts or devices, so you need a stronger password to prevent attacks from hackers.
Simple and small passwords with just uppercase or lowercase letters are pretty easy to crack. Passwords with a good combination of numbers, symbols, uppercase, and lowercase letters are very tough to crack.
The more complex the password is more secure and strong it is.
We are going to use HTML to create the structure of the app, CSS to design and style the app, and JavaScript to create logic and other feature of the app.
To create a Javascript password generator we will go through 3 steps:
The first step is to create the HTML structure of the app. The HTML structure is going to be like this:
After creating these items we will wrap these items in the <div> element and then add classes to it for styling purposes.
first create a <p> tag to show the password and add 'passwordBox' id to it for later access, also create a copy icon button using the font-awesome icon .
Now wrap these 2 item in a single <div> element with CSS class of 'password'. We will use this class later to style the elements.
Now create an input box for the length of the password using <input> tag, with type number. Create a label for it and provide min, max, and value attribute to it.
Add 'length' as an id to <input> tag and wrap both <label> tag and <input> tag in <div> element so that we may align is side by side.
We will now create 4 checkboxes for number, symbol, lowerCase, and upperCase respectively for selecting the type of characters to add in the password and wrap each of these inputs in an <input> element.
Again we will wrap each pair within an <div> element to align it side by side.
Now create a button and add onclick event to it with "createPassword()" function.
Add font-awesome CDN in the head for the icon. Here is the complete HTML code password generator.
Here is the complete HTML code for the app.
This is the output of the HTML code.
Now use CSS to style the app to look beautiful. We are using CSS flexbox properties to align-items.
Align the app to the center of the window screen using flexbox. Apply "display: flex;align-items: center;justify-content: center" on '.container' class to align app vertically and horizontally in center of the screen.
Now apply the justify-content property to the div elements that we used to wrap the pairs of labels and inputs to align at both ends of the element. i.e
Finally, add other basic CSS styles to the classes we achieve the final look. Look at the full CSS code below. Adding this code to the app will create the final look of the app.
Now it's time to create logic for the password generator. To proceed further we first must know, how to create a random number in javascript? . We will use random numbers to randomly select a character from a list of characters.
To create a random number use the Math.random() method. It returns a number between 0 and 1. We will use this concept to randomly select a character type and a character from that character type.
Let's create 4 strings that contain different types of characters numbers, symbols, upperCase and lowerCase letters to use further in the code.
Wrap these strings in an object named keys .
Now we will create a function for each of the above strings that returns a random character from the string, we will use these characters in the password.
The function generates a random number from 0 to the length of string - 1 and then returns the character at that index value of the random number from the specified string.
Math.floor(Math.random() * string.length) create a random number between 0 to length of string - 1 .
Now create an array and put all these functions in the array as array members. Look at the code below.
We put all these functions in an array because we will further create a random number between 0 and the length of the array to get a random function.
This means we will randomly pick a function that will randomly pick a character from their specified string.
Let's now create a password generator function . First, check if at least one checkbox is checked for the function to proceed. If none of the checkboxes is checked then return the function.
To check if at least one checkbox is checked grab all checkboxes using document.getElementById access method, and check if it is checked using the checked property. It returns a boolean value.
Add all these boolean values and if it is 0 then all checkbox is unchecked.
Now create an empty string named 'password' and run a while loop until the length of the 'password' string becomes equal to the length of the input password.
In each iteration of this loop create a random number between 0 and the length of the function array (0-4). Now check if the checkbox with the same name as the function is checked if it is checked then run the function and add the returned character to our password.
This loop will run until the password length becomes equal to the desired length of the password. And finally set the password as innerHTML of the password box.
Here is complete code of 'createPassword()' function.
The above function basically first selects a random function from the array 'getKey' and then runs it which then returns a random character from the string of that function. So there are 2 random selections making passwords more random.
This is the code to create a copy code functionality. It will copy the code to the clipboard of the device.
We created a random password generator javascript app in this tutorial which is customizable. It creates a strong password with variable length and the ability to select the type of characters in the password.
Find centralized, trusted content and collaborate around the technologies you use most.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Get early access and see previews of new features.
I am doing a homework assignment for a random password generator that prompts the user for length and character type. I am stuck on syntax for inputting more than one character type at a time, and when a password is generated, it is only outputting index 0 of whatever character string i specified. (Seeing "AAAAAAAAAAAAAAA" was only funny the first time.)
// Get references to the #generate element var generateBtn = document.querySelector("#generate"); // Write password to the #password input function writePassword() { //Length var length = Number(prompt("Enter the length of your password between 8-128 characters.")) //character types var charType = prompt("What should we include in your password? Type 'uppercase, lowercase, numbers, symbols' to include. ") var passwordText = document.querySelector("#password"); function password() { var charGen = { lowercase: 'abcdefghijklmnop', uppercase: 'ABCDEFGHIJKLMNOP', numbers: '0123456789', symbols: '!@#$%^&*()-_=+', }; var charSet = charGen[charType.toLowerCase()]; var retVal = ""; for (i = 0; i < length; i++) { retVal += charSet.charAt(Math.floor(Math.random() * charGen.length)); } return retVal; } passwordText.value = password(); } // Add event listener to generate button generateBtn.addEventListener("click", writePassword); function copyPassword() { document.getElementById("password").select(); navigator.clipboard.writeText(copyText.value); alert("Password copied to clipboard!" + copyText.value); } <button id="generate">Generate</button> <br> <input id="password">
I initially tried if/else statements for strings of characters, but no output was given, due to syntax errors. switched to "var charGen" assigning properties to charGen. Output now given, but only one character type can be specified in the prompt and output is the 0 index of the specified string (length is working fine now)
Error I'm receiving is "Cannot read properties of undefined (reading "charAt")" and I don't understand what that means.
charGen is your lookup, it doesn't have a length . You want the length of your charSet , which is your string of characters.
With the full answer here:
// Get references to the #generate element var generateBtn = document.querySelector("#generate"); // Write password to the #password input function writePassword() { //Length var length = Number(prompt("Enter the length of your password between 8-128 characters.")) //character types var charType = prompt("What should we include in your password? Type 'uppercase, lowercase, numbers, symbols' to include. ") var passwordText = document.querySelector("#password"); function password() { var charGen = { lowercase: 'abcdefghijklmnop', uppercase: 'ABCDEFGHIJKLMNOP', numbers: '0123456789', symbols: '!@#$%^&*()-_=+', }; var charSet = charGen[charType.toLowerCase()]; var retVal = ""; for (i = 0; i < length; i++) { retVal += charSet.charAt(Math.floor(Math.random() * charSet.length)); } return retVal; } passwordText.value = password(); } // Add event listener to generate button generateBtn.addEventListener("click", writePassword); function copyPassword() { document.getElementById("password").select(); navigator.clipboard.writeText(copyText.value); alert("Password copied to clipboard!" + copyText.value); } <button id="generate">Generate</button> <br> <input id="password">
You need to parse the user's input for the charTypes var charTypes = charType.toLowerCase().split(', '); , and then use those charTypes to generate the charSet:
Lastly, the character needs to use retVal += charSet.charAt(... charSet.length)); (the length of the set of characters) instead of retVal += charSet.charAt(... charGen.length)); (the length of the charType array).
// Get references to the #generate element var generateBtn = document.querySelector("#generate"); // Write password to the #password input function writePassword() { let passwordText = document.querySelector("#password"); //Length let length = Number(prompt("Enter the length of your password between 8-128 characters.")) //character types let charType = prompt("What should we include in your password? Type 'uppercase, lowercase, numbers, symbols' to include. ") passwordText.value = password(length, charType); function password(length, charType) { let charGen = { lowercase: 'abcdefghijklmnop', uppercase: 'ABCDEFGHIJKLMNOP', numbers: '0123456789', symbols: '!@#$%^&*()-_=+', }; var charTypes = charType.toLowerCase().split(', '); charSet = ""; for(var i=0; i < charTypes.length; i++) { charSet += charGen[charTypes[i]]; } console.log(charSet); var retVal = ""; for (var i = 0; i < length; i++) { retVal += charSet.charAt(Math.floor(Math.random() * charSet.length)); } return retVal; } } // Add event listener to generate button generateBtn.addEventListener("click", writePassword); function copyPassword() { document.getElementById("password").select(); navigator.clipboard.writeText(copyText.value); alert("Password copied to clipboard!" + copyText.value); } <button id="generate">Generate</button> <input type="text" id="password" />
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .
03 javascript: password generator.
This week’s Challenge requires you to modify starter code to create an application that enables employees to generate random passwords based on criteria that they’ve selected. This app will run in the browser and will feature dynamically updated HTML and CSS powered by JavaScript code that you write. It will have a clean and polished, responsive user interface that adapts to multiple screen sizes.
The password can include special characters. If you’re unfamiliar with these, see this list of password special characters from the OWASP Foundation.
The following image shows the web application’s appearance and functionality:
Note : If a Challenge assignment submission is marked as “0”, it is considered incomplete and will not count towards your graduation requirements. Examples of incomplete submissions include the following: A repository that has no code A repository that includes a unique name but nothing else A repository that includes only a README file but nothing else A repository that only includes starter code
This Challenge is graded based on the following criteria:
Application deployed at live URL.
Application loads with no errors.
Application GitHub URL submitted.
GitHub repository that contains application code.
Application user experience is intuitive and easy to navigate.
Application user interface style is clean and polished.
Application resembles the mock-up functionality provided in the Challenge instructions.
Repository has a unique name.
Repository follows best practices for file structure and naming conventions.
Repository follows best practices for class/id naming conventions, indentation, quality comments, etc.
Repository contains multiple descriptive commit messages.
Repository contains quality readme file with description, screenshot, and link to deployed application.
You are required to submit the following for review:
The URL of the deployed application.
The URL of the GitHub repository, with a unique name and a readme describing the project.
© 2023 edX Boot Camps LLC. Confidential and Proprietary. All Rights Reserved.
Search code, repositories, users, issues, pull requests..., provide feedback.
We read every piece of feedback, and take your input very seriously.
Use saved searches to filter your results more quickly.
To see all available qualifiers, see our documentation .
unit 03 homework JavaScript password generator
Folders and files.
Name | Name | |||
---|---|---|---|---|
7 Commits | ||||
03-homework-password-generator, unit 03-homework-javascript-password-generator, link to deployed website: https://csimonusa.github.io/03-homework-password-generator//, comments for grader- so i initially had my index.html on the root level of my repository and my style.css and script.js inside of a folder called "develop". when i deployed my application though using github pages it wasnt applying my javascript or css to the html. i tried a few things and the only solution was to move all 3 outside of the developer folder to the root level of my repository. i didnt do anything differently from my last homework repositories so im assuming the problem was the javascript file somehow. please let me know what caused this issue so i dont get points deducted for not following best file structure practices on the next assignment thank you :).
IMAGES
VIDEO
COMMENTS
Unit 03 JavaScript Homework: Password Generator. Contribute to tosh-skyler/unit-3-password-generator development by creating an account on GitHub.
Displaying the generated password in an alert is acceptable, but attempt to write the password to the page instead. \n As a bonus, the user should also have the option to click a button to copy the password to their clipboard.
This is an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by my JavaScript code. - wailam706/Unit-03-JavaScript-Homework-Password-Generator
This homework is graded based on the following criteria: Technical Acceptance Criteria: 40%. Satisfies all of the preceding acceptance criteria plus the following: The homework should not produce any errors in the console when you inspect it using Chrome DevTools. Deployment: 32%. Application deployed at live URL. Application loads with no errors.
03 JavaScript: Password Generator. Create an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by your JavaScript code. It will also feature a clean and polished user interface and be responsive, ensuring that it adapts to multiple ...
Password Generator The site contains three different pages: 1. About Me 2. Portfolio 3. Contact It showcases basic html and css learned in the first week of bootcamp as well as responsive iamges and layouts. Getting Started Page Layout Page includes a text area where the generated password will be ...
This Homework assignment we were tasked with adding javascript to already exisitng code to create a functioning random password generator with options for Capitalization , Lowercasing , numbers and special characters.
js_password_generator. Week 3 javascript homework challenge. The purpose of this website is to allow the user to the use to generate a random password with a specific chosen number of characters (between 8 - 128 characters). The random password is then written on the page.
Generate strong and random passwords by typing in the text area. The web app uses your typing time and characters as a source of entropy and saves your state across sessions.
Learn how to create a customizable password generator app using HTML, CSS and JavaScript. The app lets you set the length and choose the types of characters to include in the password.
Unit 03 JavaScript Homework: Password Generator \n Description \n. Create an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by your JavaScript code. \n. The user will be prompted to choose from the following password criteria: \n ...
Here's a free, configurable Javascript class generating random passwords: Javascript Random Password Generator. Examples. Password consisting of Lower case + upper case + numbers, 8 characters long: var randomPassword = new RandomPassword(); document.write(randomPassword.create());
Unit 03 JavaScript Homework: Password Generator. Contribute to robcruz/password-generator development by creating an account on GitHub.
I am doing a homework assignment for a random password generator that prompts the user for length and character type. I am stuck on syntax for inputting more than one character type at a time, and when a password is generated, it is only outputting index 0 of whatever character string i specified.
This is an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by my JavaScript code. \n
This app will run in the browser and will feature dynamically updated HTML and CSS powered by JavaScript code that you write. It will have a clean and polished, responsive user interface that adapts to multiple screen sizes. The password can include special characters. If you're unfamiliar with these, see this list of password special ...
This is an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by my JavaScript code....
Unit 03 Javascript: Password Generator. Contribute to BrianSoldani/03-homework-assignment-03 development by creating an account on GitHub.
Contribute to VACA16/Unit-03-JavaScript-Homework-Password-Generator development by creating an account on GitHub.
ITESM Coding Bootcamp - Unit 3 Homework - JavaScript: Password Generator - josevidmal/u3-hw-javascript-password-generator
random-password-generator \n. Homework 3 \n Unit 03 JavaScript Homework: Password Generator \n Description \n. Create an application that generates a random password based on user-selected criteria. This app will run in the browser and feature dynamically updated HTML and CSS powered by your JavaScript code. \n
Password Generator. Contribute to stephmarie17/unit-3-homework development by creating an account on GitHub.
unit 03 homework JavaScript password generator. Contribute to Csimonusa/03-homework-password-generator development by creating an account on GitHub.