line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::CBC::PBKDF::opensslv2; |
2
|
6
|
|
|
6
|
|
44
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
240
|
|
3
|
6
|
|
|
6
|
|
31
|
use base 'Crypt::CBC::PBKDF::opensslv1'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
2579
|
|
4
|
6
|
|
|
6
|
|
3600
|
use Digest::SHA 'sha256'; |
|
6
|
|
|
|
|
21067
|
|
|
6
|
|
|
|
|
1387
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# options: |
7
|
|
|
|
|
|
|
# key_len => 32 default |
8
|
|
|
|
|
|
|
# iv_len => 16 default |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub generate_hash { |
11
|
1631
|
|
|
1631
|
0
|
2056
|
my $self = shift; |
12
|
1631
|
|
|
|
|
2852
|
my ($salt,$passphrase) = @_; |
13
|
1631
|
|
|
|
|
2582
|
my $desired_len = $self->{key_len} + $self->{iv_len}; |
14
|
1631
|
|
|
|
|
2192
|
my $data = ''; |
15
|
1631
|
|
|
|
|
2196
|
my $d = ''; |
16
|
1631
|
|
|
|
|
3270
|
while (length $data < $desired_len) { |
17
|
3262
|
|
|
|
|
16796
|
$d = sha256($d . $passphrase . $salt); |
18
|
3262
|
|
|
|
|
8554
|
$data .= $d; |
19
|
|
|
|
|
|
|
} |
20
|
1631
|
|
|
|
|
3436
|
return $data; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |