Passphrase/MD5/Base64.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 97.1% 34 / 35 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Passphrase/SHA1/Hex.pm ↑ Summary Passphrase/SHA1/Base64.pm »
1 package Crypt::Passphrase::MD5::Base64;
2 2 $Crypt::Passphrase::MD5::Base64::VERSION = '0.024';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent 'Crypt::Passphrase::Validator';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Digest::MD5 'md5';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use MIME::Base64 'decode_base64';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
12 2 my $class = shift;
13 2 return bless {}, $class;
14 }
15  
16 3 ▶sub accepts_hash {
Subroutine accepts_hash: called CC=1 SCAR=0.0
Pod documented
17 3 my ($self, $hash) = @_;
18 3 return $hash =~ m{ ^ [A-Za-z0-9+/]{22} (?:==)? \z }x;
19 }
20  
21 2 ▶sub verify_password {
Subroutine verify_password: called CC=1 SCAR=0.0
Pod documented
22 2 my ($self, $password, $hash) = @_;
23 2 my $new_hash = md5($password);
24 2 return $self->secure_compare($new_hash, decode_base64($hash));
25 }
26  
27 2 1;
28  
29 # ABSTRACT: Validate against base64ed MD5 hashes with Crypt::Passphrase
30  
31 __END__
« Passphrase/SHA1/Hex.pm ↑ Summary Passphrase/SHA1/Base64.pm »