[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SLUG] MD5 passwords

* This one time, at band camp, John Ferlito said:
> Anyone know of anything similar to makepasswd which will encrypt a
> password and give you the MD5 encrypted result. ie something I can pass
> to usermod -p. Even a snippet of perl code or a pointer to the algorithm
> so I can write some perl code would do.

use Crypt::PasswdMD5;

sub cryptpw
    my $salt;
        $salt .= ('.', '/', 0..9, 'A'..'Z','a'..'z')[rand 64];
    my $pass = shift;
    return unix_md5_crypt($pass, '$1$' . $salt . '$');

quick and dirty - needs error checking etc - but it works

Greeno <tgreen@nospam.pacific.net.au>
GnuPG Key :  1024D/B5657C8B 
Key fingerprint = 9ED8 59CC C161 B857 462E  51E6 7DFB 465B B565 7C8B

Imagine working in a secure environment and finding the string 
_NSAKEY in the OS binaries without a good explanation
    -Alan Cox 04/05/2001

SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug