Also, I feel very funny using generated password from a website. If I need a new password, I can just generate one in Python or something.
Also, I feel very funny using generated password from a website. If I need a new password, I can just generate one in Python or something.
%load pwm
import random as r
import string as s
def pw(n=12):
return "".join([r.choice(
s.ascii_letters \
+ s.digits \
+ "|!@#$%&/()=?+\-_.,;:")
for x in range(n)])I prefer not to have to use the shift key in passwords, and the 34 instead of 36 ([0-9a-z]) solves my german/us layout problem in a very golfy way.
[ed: hm, no - not yet. I remembered discussions like this:
https://lwn.net/Articles/657269/
But looks like "secrets"[1] has the strong random.choice provider among others.
Probably the (minimal, dirty) change needed (for python 3.6 and later) is:
import secrets as r
But I can't test that right now. Thanks for calling me out on this, and having me do a quick search to check my assumptions.I do agree that for this particular case, the pseudo-random generator seeded by system time might be enough (or at least better than "random" key presses) - but I don't like spreading bad patterns. And for any code generating many passwords, with the opportunity for an attacker to get a sample - this is likely very bad.
rand(34**10)
rather than rand(34*10)
And you'll probably want a puts in front.In fact xkcd underestimated the entropy. The stated entropy is only true if you limit yourself to words a 4 year old would use.
Systems that limit maximum number of characters or require character classes are the worst.