line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::MD5::Hex; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::MD5::Hex::VERSION = '0.016'; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Crypt::Passphrase -validator; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use Digest::MD5 'md5'; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
197
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
2
|
|
|
2
|
1
|
36
|
my $class = shift; |
12
|
2
|
|
|
|
|
8
|
return bless {}, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub accepts_hash { |
16
|
5
|
|
|
5
|
1
|
12
|
my ($self, $hash) = @_; |
17
|
5
|
|
|
|
|
43
|
return $hash =~ / ^ [a-f0-9]{32} $/xi; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub verify_password { |
21
|
2
|
|
|
2
|
1
|
6
|
my ($self, $password, $hash) = @_; |
22
|
2
|
|
|
|
|
42
|
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__ |