line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::MD5::Base64; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::MD5::Base64::VERSION = '0.016'; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
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
|
|
|
|
|
43
|
|
9
|
1
|
|
|
1
|
|
427
|
use MIME::Base64 'decode_base64'; |
|
1
|
|
|
|
|
592
|
|
|
1
|
|
|
|
|
184
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
2
|
|
|
2
|
1
|
393
|
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
|
|
|
|
|
33
|
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
|
|
|
|
|
8
|
my $new_hash = md5($password); |
24
|
2
|
|
|
|
|
15
|
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__ |