line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Passphrase::Encoder; |
2
|
|
|
|
|
|
|
$Crypt::Passphrase::Encoder::VERSION = '0.016'; |
3
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
84
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
88
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1335
|
use parent 'Crypt::Passphrase::Validator'; |
|
3
|
|
|
|
|
940
|
|
|
3
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
1483
|
use Crypt::URandom; |
|
3
|
|
|
|
|
11071
|
|
|
3
|
|
|
|
|
520
|
|
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
|
27
|
my ($self, $hash) = @_; |
19
|
10
|
50
|
|
|
|
29
|
return 0 if not defined $hash; |
20
|
10
|
|
66
|
|
|
48
|
$self->{accepts_hash} //= do { |
21
|
5
|
50
|
|
|
|
21
|
my $string = join '|', $self->crypt_subtypes or return; |
22
|
5
|
|
|
|
|
204
|
qr/ \A \$ (?: $string ) \$ /x; |
23
|
|
|
|
|
|
|
}; |
24
|
10
|
|
|
|
|
123
|
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__ |