Answers for "strong password generator"

8

password generator

function CreatePassword(PassLenght) {
    const Lenght = parseInt(PassLenght)
   	const Charecters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    let Password = "";
    for (var i = 0, n = Charecters.length; i < Lenght; ++i) { Password += Charecters.charAt(Math.floor(Math.random() * n)); }
    console.log(Password)
    return Password;
}

CreatePassword(18)
Posted by: Guest on May-07-2021
1

strong password generator

function getpass() {
    var chars = "0123456789~!@#$%^&*()_+}{[]|abcdefghikjlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var pass = "";
    var passLength = 16;

    for (var i = 0; i < passLength; i++) {
        var randPass = Math.floor(Math.random() * chars.length);
        pass += chars.substring(randPass, randPass+1);
    }
    document.getElementById('strong_pass').value = pass;
}

function copyToClipboard() {
    var copyText = document.getElementById('strong_pass');
    var copyPass = document.getElementById('strong_pass').value;
    var fa_iocn = document.getElementsByClassName('fa');

    if (copyPass == "") {
        alert("Please Generate Password");
    }else {
        $(fa_iocn).removeClass("fa-copy");
        $(fa_iocn).addClass("fa-check");
        $("#strong_pass").addClass("focus_success");
        alert("Password Copied Successfully")
    }
    copyText.select();
    copyText.setSelectionRange(0, 99999);
    document.execCommand("copy");
}

$(".strong_pass_generator #generatorbutton").click(function(){
    $(".strong_pass_generator i").removeClass("fa-check");
    $(".strong_pass_generator i").addClass("fa-copy");
});
Posted by: Guest on September-19-2021
6

random password generator

function rand_string( $length ) {
	$str = "";
	$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

	$size = strlen( $chars );
	for( $i = 0; $i < $length; $i++ ) {
		$str .= $chars[ rand( 0, $size - 1 ) ];
	}

	return $str;
}
//and call the function this way:
$mypass = rand_string(10);
Posted by: Guest on November-09-2020
1

generate random password

var btn = document.getElementById("btn");

btn.addEventListener("click", function generate() {
  var generatePassword = "";
  var password = document.getElementById("password");
  var characters =
    "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?";

  for (var i = 0; i < 10; i++) {
    generatePassword += characters.charAt(
      Math.floor(Math.random() * characters.length)
    );
  }
  password.innerHTML = generatePassword;
});
Posted by: Guest on November-26-2020
0

password generator

// Password generator
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>  

std::string password_gen() {
  std::string result;
  while (!any_of(result.begin(), result.end(), ::islower) ||
         !any_of(result.begin(), result.end(), ::isupper) ||
         !any_of(result.begin(), result.end(), ::isdigit)) {
    std::stringstream ss;
    int length = rand() % 15 + 6;
    for (int i = 0; i < length; i++) {
      unsigned randomChar = rand() % 62;
      if (randomChar < 26)
        ss << char(randomChar + 'a');
      else if (randomChar < 52)
        ss << char(randomChar - 26 + 'A');
      else if (randomChar < 62)
        ss << char(randomChar - 52 + '0');
      result = ss.str();
    }
  }
  return result;
}

using namespace std;

int main() {

    cout<<"New random password = " << password_gen();
}
Posted by: Guest on October-04-2021
-2

password generator

import string
from random import *

characters = string.ascii_letters + string.digits
Password =  "".join(choice(characters) for x in range(randint(8, 16)))
print(Password)
Posted by: Guest on July-11-2021

Code answers related to "strong password generator"

Code answers related to "Javascript"

Browse Popular Code Answers by Language