I’ve seen some people that have a pwgen program that makes a pile of passwords for them. I always just use openssl, so I threw this solution together to emulate what I saw.
So this obvious example is really slow, or noticeable slow. Why is that? Lots of calls to openssl. We can do better I think.
Lets instead call rand once, fill a big buffer, and read from it. Then any time spent is just IO.
Well, testing shows I did save some time here (passwords.sh is first script, pwgen is the second):
If you’re ever interested in speeding things up, not repeatedly seeding
an RNG is a really good start. Calling rand in a loop is painful.