line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::CBC::PBKDF::opensslv2; |
2
|
6
|
|
|
6
|
|
43
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
222
|
|
3
|
6
|
|
|
6
|
|
32
|
use base 'Crypt::CBC::PBKDF::opensslv1'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
2553
|
|
4
|
6
|
|
|
6
|
|
2887
|
use Digest::SHA 'sha256'; |
|
6
|
|
|
|
|
16305
|
|
|
6
|
|
|
|
|
1154
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# options: |
7
|
|
|
|
|
|
|
# key_len => 32 default |
8
|
|
|
|
|
|
|
# iv_len => 16 default |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub generate_hash { |
11
|
1631
|
|
|
1631
|
0
|
1973
|
my $self = shift; |
12
|
1631
|
|
|
|
|
2618
|
my ($salt,$passphrase) = @_; |
13
|
1631
|
|
|
|
|
2671
|
my $desired_len = $self->{key_len} + $self->{iv_len}; |
14
|
1631
|
|
|
|
|
1872
|
my $data = ''; |
15
|
1631
|
|
|
|
|
1995
|
my $d = ''; |
16
|
1631
|
|
|
|
|
3425
|
while (length $data < $desired_len) { |
17
|
3262
|
|
|
|
|
16431
|
$d = sha256($d . $passphrase . $salt); |
18
|
3262
|
|
|
|
|
8865
|
$data .= $d; |
19
|
|
|
|
|
|
|
} |
20
|
1631
|
|
|
|
|
3577
|
return $data; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |