The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Crypt::Password - Unix-style, Variously Hashed Passwords

SYNOPSIS

 use Crypt::Password;
 
 # sha256, generated salt:
 my $hashed = Crypt::Password->new("password");
 
 # the above $hashed might look like:
 # $5$%RK2BU%L$aFZd1/4Gpko/sJZ8Oh.ZHg9UvxCjkH1YYoLZI6tw7K8
 # the format goes $digest$salt$hash
 
 say $hashed->check("password") ? "correct" : "wrong";
 
 # sha256, supplied salt:
 my $hashed = Crypt::Password->new("password", "salt");
 
 # md5, no salt:
 my $hashed = Crypt::Password->new("password", "", "md5");

DESCRIPTION

This is just a wrapper for perl's crypt(), which can do everything you would probably want to do to store a password, but this is supposed to provide the various uses easier.

Given a string it defaults to using sha256 and generates a salt for you. The salt can be supplied as the second argument to the constructor, or avoided by passing an empty string. The digest algorithm can be supplied as the third argument to the constructor.

KNOWN ISSUES

Doesn't seem to work on Darwin.

SUPPORT, SOURCE

If you have a problem, submit a test case via a fork of the github repo.

 http://github.com/st3vil/crypt-password

AUTHOR AND LICENCE

Code by Steve Craig, steve@catalyst.net.nz, idea by Sam Vilain, sam.vilain@catalyst.net.nz. Development commissioned by NZ Registry Services.

Copyright 2009, NZ Registry Services. This module is licensed under the Artistic License v2.0, which permits relicensing under other Free Software licenses.

SEE ALSO

Digest::SHA, Authen::Passphrase, Crypt::SaltedHash