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