How should I generate a random alphanumeric initial password for new users?

Xn0vv3r picture Xn0vv3r · Apr 29, 2009 · Viewed 7.3k times · Source

We have to automatically import a large list of users with some data into a running system. For an initial password I want to update the list (csv format at the moment) with a random alphanumeric key (8 digits).

When inserting it with a special routine (which needs a csv file), the password (in this case the alphanumeric key) is stored as a md5 hash.

i.e. I generate a random alphanumeric key:

H2A5D39A -> MD5: 1642fccf791f15d137cf31282af79752

This way I want to create a list where authenticated users can ask me for their initial password (the alphanumeric key).

Do you have a better idea for a "secret" initial password?

How would you create the alphanumeric key in Perl?

P.S.: The "running system", not programmed by us, just allowes alphanumeric passwords (no special chars,...)

Answer

Anonymous picture Anonymous · Apr 29, 2009

How would you create the alphanumeric key in Perl?

join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..8