DEV Community

Discussion on: Public Solving: Generating secure password

Collapse
 
lexlohr profile image
Alex Lohr

Math.random is not random enough, it's just a seeded pseudo-random number generator. So if an attacker knows your code, they can reduce a lot of the possible combinations they would need to try. The same goes for cycling the options, just even worse so, because instead of 72 possible characters for each positions, there would now be only 26 or even 10 left.

Thread Thread
 
dailydevtips1 profile image
Chris Bongers

They should really rename that function 😂
Yeah I've taken in account it would not be the most "random" version because of the looping method always being the same.

Thanks Alex 👏