Advertisement
Spocoman

07. Safe Passwords Generator

Jan 1st, 2022
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function safePasswordGenerator(input) {
  2.     let a = Number(input[0]);
  3.     let b = Number(input[1]);
  4.     let passCount = Number(input[2]);
  5.     let charA = 35;
  6.     let charB = 64;
  7.     let print = '';
  8.     for (let j = 1; j <= a; j++) {
  9.         for (let x = 1; x <= b; x++) {
  10.             if (charA === 56) {
  11.                 charA = 35;
  12.             }
  13.             if (charB === 97) {
  14.                 charB = 64;
  15.             }
  16.             print += `${String.fromCharCode(charA)}${String.fromCharCode(charB)}${j}${x}${String.fromCharCode(charB)}${String.fromCharCode(charA)}|`;
  17.             passCount--;
  18.             charA++;
  19.             charB++;
  20.  
  21.             if (passCount === 0) {
  22.                 break;
  23.             }
  24.         }
  25.         if (passCount === 0) {
  26.             break;
  27.         }
  28.     }
  29.     console.log(print);
  30. }
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement