Generating passwords with Perl

Tue 31 July 2007

DES:

    mkpasswd
      perl -e 'printf "%s\n", crypt("pass", "two-letter-salt")'

MD5:

    mkpasswd --hash=md5
    perl -e 'printf "%s\n", crypt("pass", "\$1\$6-8-letter-salt\$")'

PLAIN-MD5:

    perl -MDigest::MD5 -e 'printf "{PLAIN-MD5}%s\n", Digest::MD5::md5_hex("pass")'

DIGEST-MD5:

    perl -MDigest::MD5 -e 'printf "{DIGEST-MD5}%s\n", Digest::MD5::md5_hex("user:realm:pass")'