#!/usr/bin/perl # # genpasswd # $PASSWD_ALLOWED = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789"; $pw=""; $salt=""; open(RND, "< /dev/urandom") or die ("no /dev/urandom on this machine!"); while (length($pw) < 8) { $char = getc(RND); $pw .= $char if (index($PASSWD_ALLOWED, $char)>0); } while (length($salt) < 2) { $char = getc(RND); $salt .= $char if (index($PASSWD_ALLOWED, $char)>0); } close(RND); $pass = crypt($pw, $salt); print "$pw $pass\n";