File Coverage

blib/lib/Password/OWASP/Bcrypt.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 13 13 100.0


line stmt bran cond sub pod time code
1             our $VERSION = '0.004';
2             use Moose;
3 1     1   64562  
  1         422861  
  1         6  
4             # ABSTRACT: A BlowfishCrypt implemenation of Password::OWASP
5              
6             with 'Password::OWASP::AbstractBase';
7              
8             use Authen::Passphrase::BlowfishCrypt;
9 1     1   7150  
  1         19344  
  1         96  
10             my ($self, $pass) = @_;
11              
12 2     2 1 7 my $ppr = Authen::Passphrase::BlowfishCrypt->new(
13             cost => $self->cost,
14 2         56 salt_random => 1,
15             passphrase => $self->hash_password($pass),
16             );
17             return $ppr->as_rfc2307;
18             }
19 2         727612  
20             __PACKAGE__->meta->make_immutable;
21              
22              
23             =pod
24              
25             =encoding UTF-8
26              
27             =head1 NAME
28              
29             Password::OWASP::Bcrypt - A BlowfishCrypt implemenation of Password::OWASP
30              
31             =head1 VERSION
32              
33             version 0.004
34              
35             =head1 SYNOPSIS
36              
37             package MyApp::Authentication;
38              
39             use Password::OWASP::Bcrypt;
40              
41             my $user = get_from_db();
42             my $from_web = "Some very secret password";
43              
44             my $owasp = Password::OWASP::Bcrypt->new(
45             # optional
46             hashing => 'sha512',
47             update_method => sub {
48             my $password = shift;
49             $user->update_password($password);
50             return;
51             },
52             );
53              
54             if (!$owasp->check_password($from_web)) {
55             die "You cannot login";
56             }
57              
58             =head1 DESCRIPTION
59              
60             Implements BlowfishCrypt password checking.
61              
62             =head1 METHODS
63              
64             =head2 crypt_password
65              
66             Encrypt the password and return it as an RFC2307 formatted string.
67              
68             =head1 SEE ALSO
69              
70             =over
71              
72             =item * L<Password::OWASP::AbstractBase>
73              
74             =item * L<Authen::Passphrase::BlowfishCrypt>
75              
76             =back
77              
78             =head1 AUTHOR
79              
80             Wesley Schwengle <waterkip@cpan.org>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is Copyright (c) 2019 by Wesley Schwengle.
85              
86             This is free software, licensed under:
87              
88             The (three-clause) BSD License
89              
90             =cut