« blib/lib/CGI/Application/Plugin/Authentication/Driver/Generic.pm
↑ Summary
blib/lib/CGI/Application/Plugin/Authentication/Driver/Filter/sha1.pm »
| 1 | package CGI::Application::Plugin::Authentication::Driver::Filter::md5; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | |||||||||||||||||||
| 6 | 4 | ▶ | 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
| |||||||||||||||||||
| 15 | 6 | ▶ | return ( $class->filter( $param, $plain ) eq $filtered ) ? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 16 | } elsif ( length($filtered) == 16 ) { | ||||||||||||||||||
| 17 | 2 | ▶ | return ( $class->filter( 'binary', $plain ) eq $filtered ) ? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 18 | } elsif ( length($filtered) == 22 ) { | ||||||||||||||||||
| 19 | 2 | ▶ | return ( $class->filter( 'base64', $plain ) eq $filtered ) ? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 20 | } else { | ||||||||||||||||||
| 21 | 2 | ▶ | return ( $class->filter( undef, $plain ) eq $filtered ) ? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 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
lc shift() || 'hex'
MC/DC100%1/1
lc shift() || 'hex'
lc shift()
Truth table100%2/2
A
A= lc shift()
| |||||||||||||||||||
| 28 | 18 | my $plain = shift; | |||||||||||||||||
| 29 | |||||||||||||||||||
| 30 | 18 | ▶ | Digest::MD5->require || die "Digest::MD5 is required to check MD5 passwords"; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 31 | 17 | ▶ | if ( $param eq 'hex' ) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 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 | 4 | 1; | |||||||||||||||||
| 42 | __END__ | ||||||||||||||||||