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