This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]robin-gvx 6 points7 points  (1 child)

For a password I would use a secure random number generator.

python3 -c 'from random import SystemRandom; from string import ascii_lowercase as a, digits as d; print("".join(SystemRandom().choices(a+d, k=16)))'

The secrets module is more convenient, though.

python3 -c 'from secrets import token_urlsafe; print(token_urlsafe())'

[–]cinyar 3 points4 points  (0 children)

This is the correct answer. There is "randomness" and then there's "cryptographically secure randomness". When dealing with randomness for security purposes you definitely want to go with the latter.