Crypt::Password - Unix-style, Variously Hashed Passwords
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");
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.
Doesn't seem to work on Darwin.
If you have a problem, submit a test case via a fork of the github repo.
http://github.com/st3vil/crypt-password
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.
Digest::SHA, Authen::Passphrase, Crypt::SaltedHash
To install Crypt::Password, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Password
CPAN shell
perl -MCPAN -e shell install Crypt::Password
For more information on module installation, please visit the detailed CPAN module installation guide.