use Authen::Passphrase;
my $pw = Authen::Passphrase::SaltedDigest->new(
algorithm => "SHA-1",
passphrase => "passphrase",
);
If I instead wanted to be secure, and use bcrypt (which I always do, even for the most trivial sites), I would just write: my $pw = Authen::Passphrase::BlowfishCrypt->new(
cost => 8,
salt_random => 1,
passphrase => "passphrase",
);
Notice how I get better security without any extra effort? That is the joy of not being the only user of your programming language, and that's how you ensure that people do the Right Thing with your data -- make it easy for them.(I'll also mention that it gets better; with Moose type coercions, I can basically treat the password as cleartext -- the type coercion converts a Str into a Passphrase. To set it, I supply the cleartext password as an initarg when instantiating a user; when changing it, the writer accessor handles the coerciion; when checking it, I delegate to the passphrase's check_passphrase method. A great API with great security, involving almost no effort on my part. <3.)