Navegación de entradas

Generating Good Passwords, Part II

Passwords. They're the bane of computer users and a necessary evil, but they have risks
and challenges associated with them. None of the choices are great. If it's up to your
memory, you'll end up using the same password again and again. Use a password
manager like 1Password, and you're reliant on its database security and
portability. Two-factor? Um, can I borrow your phone for a minute?

Still, having complex and random passwords is definitely more secure than having a
favorite phrase or variation you've been using for years. You know what I mean,
just own it; you've been using the same PIN and password forever, right?

Last
time, I built a script that could produce a random character from one of a set
of character sets. For example, a random uppercase letter can be produced like this:

Add lowercase and a constrained set of punctuation and some rules on how many of each
you want, and you can make some pretty complicated passwords. To start, let's just
focus on a random sequence of n uppercase letters.

Remember that the ${#var} notation produces the length of the current value of that
variable, so this is an easy way to build up the $password variable until it's
equal to the target length as specified in $length.