MartenBG

06. Safe Passwords Generator

Mar 3rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function generator(input) {
  2.  
  3. let a = Number(input[0]);
  4. let b = Number(input[1]);
  5. let numberOfPass = Number(input[2]);
  6. let output = '';
  7. let count = 1;
  8. let aA = 35;
  9. let bB = 64;
  10.  
  11. for (let x = 1; x <= a; x++) {
  12. for (let y = 1; y <= b; y++) {
  13. output += `${String.fromCharCode(aA)}${String.fromCharCode(bB)}${x}${y}${String.fromCharCode(bB)}${String.fromCharCode(aA)}|`;
  14. count++;
  15. aA++;
  16. bB++;
  17. if (aA > 55) {
  18. aA = 35;
  19. }
  20. if (bB > 96) {
  21. bB = 64;
  22. }
  23. if (count > numberOfPass) {
  24. console.log(output);
  25. return;
  26. }
  27. }
  28. }
  29. console.log(output);
  30. }
Add Comment
Please, Sign In to add comment