line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::Encoder; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::Encoder::VERSION = '0.015'; |
3
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
88
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1372
|
use parent 'Crypt::Passphrase::Validator'; |
|
3
|
|
|
|
|
956
|
|
|
3
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
1428
|
use Crypt::URandom; |
|
3
|
|
|
|
|
10699
|
|
|
3
|
|
|
|
|
508
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub random_bytes { |
11
|
1
|
|
|
1
|
1
|
3
|
my ($self, $count) = @_; |
12
|
1
|
|
|
|
|
3
|
return Crypt::URandom::urandom($count); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub crypt_subtypes; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub accepts_hash { |
18
|
10
|
|
|
10
|
1
|
22
|
my ($self, $hash) = @_; |
19
|
10
|
50
|
|
|
|
33
|
return 0 if not defined $hash; |
20
|
10
|
|
66
|
|
|
48
|
$self->{accepts_hash} //= do { |
21
|
5
|
50
|
|
|
|
19
|
my $string = join '|', $self->crypt_subtypes or return; |
22
|
5
|
|
|
|
|
173
|
qr/ \A \$ (?: $string ) \$ /x; |
23
|
|
|
|
|
|
|
}; |
24
|
10
|
|
|
|
|
118
|
return $hash =~ $self->{accepts_hash}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub binary_safe { |
28
|
0
|
|
|
0
|
1
|
|
return 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#ABSTRACT: Base class for Crypt::Passphrase encoders |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |