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