Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Crypt::PasswdMD5

Name Crypt::PasswdMD5
Version 1.41
Located at /usr/share/perl5
File /usr/share/perl5/Crypt/PasswdMD5.pm
Is Core No
Search CPAN for this module Crypt::PasswdMD5
Documentation Crypt::PasswdMD5
Module Details Crypt::PasswdMD5


NAME

Crypt::PasswdMD5 - Provide interoperable MD5-based crypt() functions


SYNOPSIS

        use strict;
        use warnings;
        use Crypt::PasswdMD5;
        my($password)       = 'seekrit';
        my($salt)           = 'pepperoni';
        my($unix_crypted)   = unix_md5_crypt($password, $salt);
        my($apache_crypted) = apache_md5_crypt($password, $salt);
        Or:
        use strict;
        use warnings;
        use Crypt::PasswdMD5 'random_md5_salt';
        my($length) = 7;
        my($salt_1) = random_md5_salt($length);
        my($salt_2) = random_md5_salt(); # Default to $length == 8.


DESCRIPTION

apache_md5_crypt() provides a function compatible with Apache's .htpasswd files. This was contributed by Bryan Hart <bryan@eai.com>. This function is exported by default.

The unix_md5_crypt() provides a crypt()-compatible interface to the rather new MD5-based crypt() function found in modern operating systems. It's based on the implementation found on FreeBSD 2.2.[56]-RELEASE. This function is also exported by default.

For both functions, if a salt value is not supplied, a random salt will be generated, using the function random_md5_salt(). This function is not exported by default.


LICENSE AND WARRANTY

This code and all accompanying software comes with NO WARRANTY. You use it at your own risk.

This code and all accompanying software can be used freely under the same terms as Perl itself.


METHODS

apache_md5_crypt($password, $salt)

This sets a magic variable, and then passes all the calling parameters to unix_md5_crypt($password, $salt).

Returns an encrypted version of the given password.

Basically, it's a very poor choice for anything other than password authentication.

random_md5_salt([$length])

Here, [] indicate an optional parameter.

Returns a random salt of the given length.

The maximum length is 8.

If $length is omitted, it defaults to 8.

unix_md5_crypt($password, $salt)

Returns an encrypted version of the given password.

Basically, it's a very poor choice for anything other than password authentication.


Repository

https://github.com/ronsavage/Crypt-PasswdMD5.git


SUPPORT

Bugs should be reported via the CPAN bug tracker at

https://github.com/ronsavage/Crypt-PasswdMD5/issues


AUTHOR

Luis E. Muñoz <luismunoz@cpan.org>.

Maintenance by Ron Savage <rsavage@cpan.org> as of V 1.40.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026