showing results for - "password generator javascript"
Anis
22 Apr 2018
1function generatePassword(passwordLength) {
2  var numberChars = "0123456789";
3  var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
4  var lowerChars = "abcdefghijklmnopqrstuvwxyz";
5  var allChars = numberChars + upperChars + lowerChars;
6  var randPasswordArray = Array(passwordLength);
7  randPasswordArray[0] = numberChars;
8  randPasswordArray[1] = upperChars;
9  randPasswordArray[2] = lowerChars;
10  randPasswordArray = randPasswordArray.fill(allChars, 3);
11  return shuffleArray(randPasswordArray.map(function(x) { return x[Math.floor(Math.random() * x.length)] })).join('');
12}
13
14function shuffleArray(array) {
15  for (var i = array.length - 1; i > 0; i--) {
16    var j = Math.floor(Math.random() * (i + 1));
17    var temp = array[i];
18    array[i] = array[j];
19    array[j] = temp;
20  }
21  return array;
22}
23
24alert(generatePassword(12));
Jonah
12 Jul 2018
1var Password = {
2 
3  _pattern : /[a-zA-Z0-9_\-\+\.]/,
4  
5  
6  _getRandomByte : function()
7  {
8    // http://caniuse.com/#feat=getrandomvalues
9    if(window.crypto && window.crypto.getRandomValues) 
10    {
11      var result = new Uint8Array(1);
12      window.crypto.getRandomValues(result);
13      return result[0];
14    }
15    else if(window.msCrypto && window.msCrypto.getRandomValues) 
16    {
17      var result = new Uint8Array(1);
18      window.msCrypto.getRandomValues(result);
19      return result[0];
20    }
21    else
22    {
23      return Math.floor(Math.random() * 256);
24    }
25  },
26  
27  generate : function(length)
28  {
29    return Array.apply(null, {'length': length})
30      .map(function()
31      {
32        var result;
33        while(true) 
34        {
35          result = String.fromCharCode(this._getRandomByte());
36          if(this._pattern.test(result))
37          {
38            return result;
39          }
40        }        
41      }, this)
42      .join('');  
43  }    
44    
45};
Mohammed
26 Nov 2016
1/*
2    This code comes from Vincent Lab
3    And it has a video version linked here: https://www.youtube.com/watch?v=PtnYuiIyqeM
4*/
5
6function generate() {
7
8    let password = "";
9
10    let length = +document.getElementById("length").value;
11
12    let lowerCase = document.getElementById("lowercase").checked;
13    let upperCase = document.getElementById("uppercase").checked;
14    let symbol = document.getElementById("symbols").checked;
15    let number = document.getElementById("numbers").checked;
16
17    if (lowerCase + upperCase + symbol + number <= 0)
18        return;
19
20    for (let i = 0; i < length; i++) {
21
22        const r = generater(0, 3);
23        if (lowerCase && r === 0) {
24            password += generateRandomLowerCase();
25        } else if (upperCase && r === 1) {
26            password += generateRandomUpperCase();
27        } else if (symbol && r === 2) {
28            password += generateRandomSymbol();
29        } else if (number && r === 3) {
30            password += generater(0, 9);
31        } else {
32            i--;
33        }
34
35    }
36
37    document.getElementById("result").textContent = password;
38
39}
40
41generate();
42
43function generateRandomLowerCase() {
44    return String.fromCharCode(generater(97, 122));
45}
46
47function generateRandomUpperCase() {
48    return String.fromCharCode(generater(65, 90));
49}
50
51function generateRandomSymbol() {
52    const symbols = "~*$%@#^&!?*'-=/,.{}()[]<>";
53    return symbols[generater(0, symbols.length - 1)];
54}
55
56function generater(min = 0, max = 1) {
57    return Math.floor(Math.random() * (max + 1 - min) + min);
58}
Shayne
17 Oct 2018
1function getpass() {
2    var chars = "0123456789~!@#$%^&*()_+}{[]|abcdefghikjlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3    var pass = "";
4    var passLength = 16;
5    for (var i = 0; i < passLength; i++) {
6        var randPass = Math.floor(Math.random() * chars.length);
7        pass += chars.substring(randPass, randPass+1);
8    }
9    document.getElementById('strong_pass').value = pass;
10}
11function copyToClipboard() {
12    var copyText = document.getElementById('strong_pass');
13    var copyPass = document.getElementById('strong_pass').value;
14    var fa_iocn = document.getElementsByClassName('fa');
15    if (copyPass == "") {
16        alert("Please Generate Password");
17    }else {
18        $(fa_iocn).removeClass("fa-copy");
19        $(fa_iocn).addClass("fa-check");
20        $("#strong_pass").addClass("focus_success");
21        alert("Password Copied Successfully")
22    }
23    copyText.select();
24    copyText.setSelectionRange(0, 99999);
25    document.execCommand("copy");
26}
27$(".strong_pass_generator #generatorbutton").click(function(){
28    $(".strong_pass_generator i").removeClass("fa-check");
29    $(".strong_pass_generator i").addClass("fa-copy");
30});
Sophie
01 Jan 2017
1/**
2 * Get Auto Generated Random Password
3 * 
4 * @param   int     length, eg: Default Length = 10
5 * 
6 * @return  string  Auto generated random password
7 */
8const getAutoGeneratedPassword = (length = 10) => {
9    const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
10          genPass = "";
11
12    for (let i = 0, n = charset.length; i < length; ++i) {
13        genPass += charset.charAt(Math.floor(Math.random() * n));
14    }
15
16    return genPass;
17}
Caterina
29 Mar 2018
1 const Numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
2  const Names = ["Aaran", "Aaren", "Aodeba","Zaid", "Zain", "Zaine", "Zaineddine", "Zainedin", "Zak", "Zakaria", "Zakariya", "Zakary", "Zaki", "Zakir", "Zakk", "Zamaar", "Zander", "Zane", "Zarran", "Zayd", "Zayn", "Zayne", "Ze", "Zechariah", "Zeek", "Zeeshan", "Zeid", "Zein", "Zen", "Zendel", "Zenith", "Zennon", "Zeph", "Zerah", "Zhen", "Zhi", "Zhong", "Zhuo", "Zi", "Zidane", "Zijie", "Zinedine", "Zion", "Zishan", "Ziya", "Ziyaan", "Zohaib", "Zohair", "Zoubaeir", "Zubair", "Zubayr", "Zuriel"]
3  const Symbols = ["#", "£", "@", "%", "?", "!", "+", "$", "-", "*"]
4  const RandomName = Names[Math.floor(Math.random() * Names.length)];
5  const RandomNumber = Numbers[Math.floor(Math.random() * Numbers.length)];
6  const RandomNumber2 = Numbers[Math.floor(Math.random() * Numbers.length)];
7  const RandomSymbol = Symbols[Math.floor(Math.random() * Symbols.length)];
8  const RandomSymbol2 = Symbols[Math.floor(Math.random() * Symbols.length)];
9  const RandomSymbol3 = Symbols[Math.floor(Math.random() * Symbols.length)];
10  const RandomSymbol4 = Symbols[Math.floor(Math.random() * Symbols.length)];
11  const Password = `${RandomNumber2}${RandomSymbol}${RandomName}${RandomNumber}${RandomSymbol4}`
12  const Password2 = `${RandomNumber2}${RandomSymbol2}${RandomName}${RandomSymbol3}${RandomSymbol4}`
13  const Password3 = `${RandomNumber}${RandomNumber2}${RandomName}${RandomNumber}${RandomSymbol4}`
14  const Password4 = `${RandomSymbol2}${RandomSymbol3}${RandomName}${RandomNumber2}${RandomNumber}`
15  const Passwords = [Password, Password2, Password3, Password4]
16  const GeneratedPassword = Passwords[Math.floor(Math.random() * Passwords.length)];
17  const GeneratedPasswordToLowerCase = GeneratedPassword.toLowerCase()
18  /* Print The Passwords*/
19  console.log(GeneratedPassword)
20  console.log(GeneratedPasswordToLowerCase)
queries leading to this page
password generator js confirmangular random password generatorrandom password generator in jshow to make a password generator whit javascriptrandom password using simple javascriptcreating a password generator in javascriptjavascript code for random password generatorjavascript strong password generatorpassword generator website jshow to make a random password generator in javascriptjavascript challenge password generatorhow to generate password jspassword generator with specific length jsjavascript random password generator with rulesjavascript generate strong passwordpassword generator nodpe jshtml and js password generatorpassword genarator by jsgenerate temp password javascrtiphow to make a password generator in javascript with upper and lowerbuild a password generator with javascript tutorialmake a assword generator jsunique password javascripthow to generate random passwrd javascriptgenrate random password in jsjavascript random password generator 5dgeneratore password javascriptjavascript random password generatorrandom password generateur jsjavascript password generator returning integerscreate a random password generator javacriptfor loops for password generatorn javascriptmake method in javascript for password generatorjavascript password generatohow to create a random password generator in javascriptusing js to generate passwordjavascript random password generator with timerandom password generator in javascriptrandom password angularjavascript generate complex passwordpassword generator in javascript setting minum lenghthow to create a password generator with javascriptstrong password generator javascriptgenerate random password with special characters javascrtipvanilla javascript multiple character array password generatorcreate password generator app javascript sectionjs generate passwordjavascript generate passwordjavascript generate random passwordonline password generator javascriptpassword gen in jsgenerate password javascriptgeneratepassword 28 29 javascriptrandom password generator with javascripthow to create a password creator using javascripthow to generate a random password in javascriptpassword generator javascrptgenrate password function javascriptgenerate random password stackoverflow javascriptplain javascript generate random passjs secure password generatorpassword function generator jsjs generate random strong passwordgenerate password in javascriptpasswordgen 28num 29 jsjquery password generatorcreate password generator javascriptcreate a random password with map function javascriptjscriot generate password from certain carssection 3acreate password generator app javascripthow to make a password generatorin javascriptauto generate password in javascripthow to start a password genertor in javascript3 random words password generator javascriptpassword generator javascriptfunction random password jspassword genarator javascriptjs generate password stringjavacript logic password generatorjavascript password generator librarygeneraterandom password jsbycript random password generatorcreate random password in javascripthow to generate 8 character password in jsjavascript spa password creatorpassword generator web app with javascriptjs password generator onlinegenerate random password jsrandom characters prefills password stackoverflow reactjavascript complex password generatorpassword generator jsrandom password generator jsjavascript password generatorcreate javascript password generatorjavascript random password generator sinplepassword generator javascript codewrite js code to make random password generatorcode for random password generator in javascriptpassword generator js libraryalgorithm for password generator jsgenerate secure string password in nodejsjs password generatorjs password genhow to create a password generator using jsgeneratepassword 28 29 jsnode create random passwordgenerate password with jsgetasecurerandompassword 28 29 javascriptpassword generator algorithm javascriptgeneratepassword 28 29 3b jsgenerate random password jquerygeneerate password jscreate an random password jspassword gen javascriptnode generate random passwordhow to auto generate password in javascriptpassword generator in javascript without es6secure password generator jsstrong password javascriptcreate a simple password generator javascriptgenerate random password javascriptpassword generator javascript simplelogic behind password generator javascripthow to create a random password generator javascriptpassword generator node jsjavascript 2b password generatorpassword generator in jsauto generate password jquerystrong password generator jsjavascript variable betwen 8 and 128 characterspassword generator and password strength using javascriptgenerator strong password jspassword generator java scriptnodejs password generate numbers onlyjavascript random password generater with min8charcreate random password javascriptpassword generator on jrandom password generator javascripthow to create a password generator in javascriptis it okay to make a password generator and store it using jscommon password generator jsjavascript for loop password generatormaking a password generator in jsprompt for password generator javascriptgenerate 10 character password jquerygenerate password javascript codegenerate strong password javascripthow to create a password generator javascriptjavascript password generator with if statementmake password generator javascriptpassword generator in javascript codevar randnum 3d math floor 28math random 28 29 2a chars length 29 3b password 3d password 2b chars 5brandnum 5d console log 28password 29how to create a for loop for a random password generator javascriptgenerate random and unique password javascriptjs password genrfunction that create a password with the length of the parameter in javascriptpassword with 8 characters in nodejslist of special characters for javascript password generategenerate password jsrandom password genreator javasscriptgenerate random password with javascriptgenerating password javascriptjs generator passwordjs function generator random passwordjavascript password generator npmbuild password generator with if statements javascriptrandom password jsjs randomly generate a password that meets certain criteriagenerate random password vanilla jspassword generator javascript numberpassword generator with javascriptcreate password generator javascript errorpassword generator js codei want to generate password in javascripthow to create a for loop for a password generator javascriptrandom password generator using jsrandom password generator in c 23gen password javascriptgenerate password hash jspassword generator javascript using confirm and promptrandom password generator javascript for ijavascript for loop password generator even distributionhow to create password generator in javascriptjavascript password generator examplegenerate automatic password javascripthow do you write a for loop in javascript for password generatornode js random passwordjs generate passowrdwhere to console log when generating random passwordscreate password generator app javascriptjavascript generate password stringjavascript homework 3a password generatorpassword generator steps in javascriptjs for password suggestiongenerator of password script javascriptgenerate password with javascriptgenerate random password function javascriptrandom password generator character length javascripttypescript random password generatorjavascript password generator with rulesjs make a random passwordwhat is password generator javascriptjs how to generate a passwordrandom strong password generator in jspassword generator coding javascriptgenerate a strong password using javascriptpassword list generator javascriptjs random password generatorrandom password javascriptjavascript password generator with special symbolajavascript generate password with special charactersjs auto generate passwords with regexjavascript generate password functionrandom password generator tutorial javascrpt alwys include special caharcetsjavascript generate a passwordhow to generate random password javascript using varpassword generator using javascriptradom password jspassword generator in javascriptauto generate password jquery with one upper case lowercase and special charterpassword from word generator javascriptgenerate random password string javasriptgenerate 8 digit random password in javascripthow to generate password in javascriptlimit number of characters password generator jsjs random simple password generatorhow to create a random password in javascripthow to make a password generator in javascriptjs generate random passwordjavascript 3a password generatorrandom password generator function javascriptcreating a password generator javascriptpassword generator javascript