Authentication/Driver/Filter/md5.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 22 / 22 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 100% 61 / 61 SCAR 25.6
CC
13
Cov
100%
check
8.0
filter
6.0
BEGIN
1.0
CRAP 13.0
« Authentication/Driver.pm ↑ Summary Authentication/Driver/Filter/sha1.pm »
1 package CGI::Application::Plugin::Authentication::Driver::Filter::md5;
2 3 $CGI::Application::Plugin::Authentication::Driver::Filter::md5::VERSION = '0.21';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use UNIVERSAL::require;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub check {
9 12 ▶ my $class = shift;
Subroutine check: called CC=8 SCAR=20.8
Pod documented
10 12 my $param = shift;
11 12 my $plain = shift;
12 12 my $filtered = shift;
13  
14 12 ▶ if ($param) {
Branch: 3 branches
BranchTrueFalseTotal
if ($param) { } 6 6 12
elsif (length $filtered == 16) { } 2 4 6
elsif (length $filtered == 22) { } 2 2 4
15 6 ▶ return ( $class->filter( $param, $plain ) eq $filtered ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$class->filter($param, $plain) eq $filtered ? : 3 3 6
16 } elsif ( length($filtered) == 16 ) {
17 2 ▶ return ( $class->filter( 'binary', $plain ) eq $filtered ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$class->filter('binary', $plain) eq $filtered ? : 1 1 2
18 } elsif ( length($filtered) == 22 ) {
19 2 ▶ return ( $class->filter( 'base64', $plain ) eq $filtered ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$class->filter('base64', $plain) eq $filtered ? : 1 1 2
20 } else {
21 2 ▶ return ( $class->filter( undef, $plain ) eq $filtered ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$class->filter(undef, $plain) eq $filtered ? : 1 1 2
22 }
23 }
24  
25 sub filter {
26 18 ▶ my $class = shift;
Subroutine filter: called CC=6 SCAR=17.9
Pod documented
27 18 ▶ my $param = lc (shift || 'hex');
Condition100%2/2
shift() || 'hex'
l!l
144
MC/DC100%1/1
shift() || 'hex'
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
28 18 my $plain = shift;
29  
30 18 ▶ Digest::MD5->require || die "Digest::MD5 is required to check MD5 passwords";
Branch: 1 branch
BranchTrueFalseTotal
"Digest::MD5"->require or die "Digest::MD5 is required to check MD5 passwords" 1 17 18
31 17 ▶ if ( $param eq 'hex' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($param eq 'hex') { } 6 11 17
elsif ($param eq 'base64') { } 5 6 11
elsif ($param eq 'binary') { } 5 1 6
32 6 return Digest::MD5::md5_hex($plain);
33 } elsif ( $param eq 'base64' ) {
34 5 return Digest::MD5::md5_base64($plain);
35 } elsif ( $param eq 'binary' ) {
36 5 return Digest::MD5::md5($plain);
37 }
38 1 die "Unknown MD5 format $param";
39 }
40  
41 3 1;
42 __END__
« Authentication/Driver.pm ↑ Summary Authentication/Driver/Filter/sha1.pm »