line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::CBC::PBKDF::opensslv2; |
2
|
6
|
|
|
6
|
|
38
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
190
|
|
3
|
6
|
|
|
6
|
|
27
|
use base 'Crypt::CBC::PBKDF::opensslv1'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
1940
|
|
4
|
6
|
|
|
6
|
|
2484
|
use Digest::SHA 'sha256'; |
|
6
|
|
|
|
|
14192
|
|
|
6
|
|
|
|
|
1117
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# options: |
7
|
|
|
|
|
|
|
# key_len => 32 default |
8
|
|
|
|
|
|
|
# iv_len => 16 default |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub generate_hash { |
11
|
1631
|
|
|
1631
|
0
|
1641
|
my $self = shift; |
12
|
1631
|
|
|
|
|
2293
|
my ($salt,$passphrase) = @_; |
13
|
1631
|
|
|
|
|
2252
|
my $desired_len = $self->{key_len} + $self->{iv_len}; |
14
|
1631
|
|
|
|
|
1664
|
my $data = ''; |
15
|
1631
|
|
|
|
|
1591
|
my $d = ''; |
16
|
1631
|
|
|
|
|
2932
|
while (length $data < $desired_len) { |
17
|
3262
|
|
|
|
|
15888
|
$d = sha256($d . $passphrase . $salt); |
18
|
3262
|
|
|
|
|
7216
|
$data .= $d; |
19
|
|
|
|
|
|
|
} |
20
|
1631
|
|
|
|
|
3096
|
return $data; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |