File Coverage

blib/lib/Crypt/Passphrase/MD5/Hex.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::MD5::Hex;
2             $Crypt::Passphrase::MD5::Hex::VERSION = '0.023';
3 2     2   230345 use strict;
  2         5  
  2         89  
4 2     2   13 use warnings;
  2         5  
  2         188  
5              
6 2     2   17 use parent 'Crypt::Passphrase::Validator';
  2         11  
  2         19  
7              
8 2     2   144 use Digest::MD5 'md5';
  2         5  
  2         568  
9              
10             sub new {
11 2     2 0 40 my $class = shift;
12 2         9 return bless {}, $class;
13             }
14              
15             sub accepts_hash {
16 5     5 1 16 my ($self, $hash) = @_;
17 5         29 return $hash =~ / ^ [a-f0-9]{32} $/xi;
18             }
19              
20             sub verify_password {
21 2     2 1 7 my ($self, $password, $hash) = @_;
22 2         26 return $self->secure_compare(md5($password), pack 'H32', $hash);
23             }
24              
25             1;
26              
27             # ABSTRACT: Validate against hexed MD5 hashes with Crypt::Passphrase
28              
29             __END__