Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Code golf: Password generator mk2
- Constraints: Password must be 16char, must contain 1 lowercase, 1 uppercase, 1 number - no special chars allowed
- I chose to brute-force a valid string out of pseudo-randomly generated strings; you can actually make it generate safer passwords by adjusting the range of charcodes it accepts, and adjusting the "pass"-criteria regex to require special chars.
- 2019-01-04: 135 bytes (135chr)
- */
- do{for(i=17,q="";i>q.length;q+=String.fromCharCode(~~(Math.random()*74)+48));}while(!/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{16,}$/g.test(q))q
Add Comment
Please, Sign In to add comment