line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::SHA1::Hex; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::SHA1::Hex::VERSION = '0.016'; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Crypt::Passphrase -validator; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
499
|
use Digest::SHA 'sha1'; |
|
1
|
|
|
|
|
2979
|
|
|
1
|
|
|
|
|
221
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
2
|
|
|
2
|
1
|
322
|
my $class = shift; |
12
|
2
|
|
|
|
|
7
|
return bless {}, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub accepts_hash { |
16
|
4
|
|
|
4
|
1
|
11
|
my ($self, $hash) = @_; |
17
|
4
|
|
|
|
|
55
|
return $hash =~ / ^ [a-f0-9]{40} $/xi; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub verify_password { |
21
|
2
|
|
|
2
|
1
|
40
|
my ($self, $password, $hash) = @_; |
22
|
2
|
|
|
|
|
64
|
return sha1($password) eq pack('H40', $hash); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# ABSTRACT: Validate against hexed SHA1 hashes with Crypt::Passphrase |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |