| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Crypt::CBC::PBKDF::opensslv2; |
|
2
|
6
|
|
|
6
|
|
38
|
use strict; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
302
|
|
|
3
|
6
|
|
|
6
|
|
36
|
use base 'Crypt::CBC::PBKDF::opensslv1'; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
3232
|
|
|
4
|
6
|
|
|
6
|
|
3174
|
use Digest::SHA 'sha256'; |
|
|
6
|
|
|
|
|
48291
|
|
|
|
6
|
|
|
|
|
1876
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '3.07'; |
|
7
|
|
|
|
|
|
|
# options: |
|
8
|
|
|
|
|
|
|
# key_len => 32 default |
|
9
|
|
|
|
|
|
|
# iv_len => 16 default |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub generate_hash { |
|
12
|
3143
|
|
|
3143
|
0
|
4411
|
my $self = shift; |
|
13
|
3143
|
|
|
|
|
6726
|
my ($salt,$passphrase) = @_; |
|
14
|
3143
|
|
|
|
|
6412
|
my $desired_len = $self->{key_len} + $self->{iv_len}; |
|
15
|
3143
|
|
|
|
|
4664
|
my $data = ''; |
|
16
|
3143
|
|
|
|
|
8863
|
my $d = ''; |
|
17
|
3143
|
|
|
|
|
7966
|
while (length $data < $desired_len) { |
|
18
|
6286
|
|
|
|
|
34006
|
$d = sha256($d . $passphrase . $salt); |
|
19
|
6286
|
|
|
|
|
21368
|
$data .= $d; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
3143
|
|
|
|
|
8000
|
return $data; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |