line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::MD5::Base64; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::MD5::Base64::VERSION = '0.015'; |
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Crypt::Passphrase -validator; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Digest::MD5 'md5'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
9
|
1
|
|
|
1
|
|
439
|
use MIME::Base64 'decode_base64'; |
|
1
|
|
|
|
|
639
|
|
|
1
|
|
|
|
|
197
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
2
|
|
|
2
|
1
|
312
|
my $class = shift; |
13
|
2
|
|
|
|
|
8
|
return bless {}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub accepts_hash { |
17
|
3
|
|
|
3
|
1
|
8
|
my ($self, $hash) = @_; |
18
|
3
|
|
|
|
|
18
|
return $hash =~ m{ ^ [A-Za-z0-9+/]{22} (?:==)? $ }x; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub verify_password { |
22
|
2
|
|
|
2
|
1
|
5
|
my ($self, $password, $hash) = @_; |
23
|
2
|
|
|
|
|
9
|
my $new_hash = md5($password); |
24
|
2
|
|
|
|
|
13
|
return $new_hash eq decode_base64($hash); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# ABSTRACT: Validate against base64ed MD5 hashes with Crypt::Passphrase |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |