line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::Authentication::Driver::Filter::md5; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2637
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
182
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
210
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
738
|
use UNIVERSAL::require; |
|
4
|
|
|
|
|
1345
|
|
|
4
|
|
|
|
|
47
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub check { |
10
|
12
|
|
|
12
|
1
|
21
|
my $class = shift; |
11
|
12
|
|
|
|
|
12
|
my $param = shift; |
12
|
12
|
|
|
|
|
14
|
my $plain = shift; |
13
|
12
|
|
|
|
|
518
|
my $filtered = shift; |
14
|
|
|
|
|
|
|
|
15
|
12
|
100
|
|
|
|
32
|
if ($param) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
16
|
6
|
100
|
|
|
|
16
|
return ( $class->filter( $param, $plain ) eq $filtered ) ? 1 : 0; |
17
|
|
|
|
|
|
|
} elsif ( length($filtered) == 16 ) { |
18
|
2
|
100
|
|
|
|
4
|
return ( $class->filter( 'binary', $plain ) eq $filtered ) ? 1 : 0; |
19
|
|
|
|
|
|
|
} elsif ( length($filtered) == 22 ) { |
20
|
2
|
100
|
|
|
|
5
|
return ( $class->filter( 'base64', $plain ) eq $filtered ) ? 1 : 0; |
21
|
|
|
|
|
|
|
} else { |
22
|
2
|
100
|
|
|
|
5
|
return ( $class->filter( undef, $plain ) eq $filtered ) ? 1 : 0; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub filter { |
27
|
26
|
|
|
26
|
1
|
578
|
my $class = shift; |
28
|
26
|
|
100
|
|
|
808
|
my $param = lc shift || 'hex'; |
29
|
26
|
|
|
|
|
41
|
my $plain = shift; |
30
|
|
|
|
|
|
|
|
31
|
26
|
100
|
|
|
|
272
|
Digest::MD5->require || die "Digest::MD5 is required to check MD5 passwords"; |
32
|
25
|
100
|
|
|
|
699
|
if ( $param eq 'hex' ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
33
|
14
|
|
|
|
|
159
|
return Digest::MD5::md5_hex($plain); |
34
|
|
|
|
|
|
|
} elsif ( $param eq 'base64' ) { |
35
|
5
|
|
|
|
|
34
|
return Digest::MD5::md5_base64($plain); |
36
|
|
|
|
|
|
|
} elsif ( $param eq 'binary' ) { |
37
|
5
|
|
|
|
|
35
|
return Digest::MD5::md5($plain); |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
13
|
die "Unknown MD5 format $param"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |