File Coverage

blib/lib/Crypt/Passphrase/Bcrypt/Compat.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 2 3 66.6
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Crypt::Passphrase::Bcrypt::Compat;
2             $Crypt::Passphrase::Bcrypt::Compat::VERSION = '0.004';
3 2     2   265269 use strict;
  2         5  
  2         93  
4 2     2   10 use warnings;
  2         4  
  2         120  
5              
6 2     2   15 use parent 'Crypt::Passphrase::Validator';
  2         6  
  2         14  
7              
8 2     2   2238 use Crypt::Eksblowfish::Bcrypt qw/bcrypt/;
  2         4033  
  2         374  
9              
10             sub new {
11 1     1 0 236634 my ($class) = @_;
12 1         3 return bless {}, $class;
13             }
14              
15             sub accepts_hash {
16 1     1 1 1761020 my ($self, $hash) = @_;
17 1         15 return $hash =~ /^\$2a?\$/;
18             }
19              
20             sub verify_password {
21 1     1 1 5 my ($class, $password, $hash) = @_;
22 1         8 $class->secure_compare(bcrypt($password, $hash), $hash);
23             }
24              
25             1;
26              
27             #ABSTRACT: A bcrypt validator for Crypt::Passphrase
28              
29             __END__