line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
26
|
use v5.26; |
|
2
|
|
|
|
|
8
|
|
2
|
2
|
|
|
2
|
|
11
|
use Object::Pad; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Blockchain::Ethereum::Keystore::Keyfile::KDF 0.005; |
5
|
|
|
|
|
|
|
class Blockchain::Ethereum::Keystore::Keyfile::KDF; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1718
|
use Crypt::KeyDerivation qw(pbkdf2); |
|
2
|
|
|
|
|
728
|
|
|
2
|
|
|
|
|
133
|
|
8
|
2
|
|
|
2
|
|
1074
|
use Crypt::ScryptKDF qw(scrypt_raw); |
|
2
|
|
|
|
|
6183
|
|
|
2
|
|
|
|
|
3065
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
0
|
5
|
field $algorithm :reader :writer :param; |
|
2
|
|
|
2
|
0
|
10
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
13
|
|
11
|
2
|
|
|
2
|
0
|
5
|
field $dklen :reader :writer :param; |
|
2
|
|
|
2
|
0
|
822827
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
12
|
|
|
|
|
|
|
field $n :reader :writer :param //= undef; |
13
|
1
|
|
|
1
|
0
|
3
|
field $p :reader :writer :param //= undef; |
|
1
|
|
|
2
|
0
|
6
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
0
|
2
|
field $r :reader :writer :param //= undef; |
|
1
|
|
|
2
|
0
|
6
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
8
|
|
15
|
1
|
|
|
1
|
0
|
3
|
field $prf :reader :writer :param //= undef; |
|
1
|
|
|
2
|
0
|
7
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
8
|
|
16
|
0
|
|
|
0
|
0
|
0
|
field $c :reader :writer :param //= undef; |
|
0
|
|
|
0
|
0
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
17
|
1
|
|
|
1
|
0
|
2
|
field $salt :reader :writer :param; |
|
1
|
|
|
2
|
0
|
4
|
|
|
2
|
|
|
0
|
0
|
5
|
|
|
2
|
|
|
2
|
0
|
23
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
8
|
|
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
0
|
7
|
method decode ($password) { |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
9
|
my $kdf_function = '_decode_kdf_' . $self->algorithm; |
22
|
2
|
|
|
|
|
9
|
return $self->$kdf_function($password); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
2
|
method _decode_kdf_pbkdf2 ($password) { |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
3
|
my $derived_key = pbkdf2($password, pack("H*", $self->salt), $self->c, 'SHA256', $self->dklen); |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
42
|
return $derived_key; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
4
|
method _decode_kdf_scrypt ($password) { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
5
|
my $derived_key = scrypt_raw( |
35
|
|
|
|
|
|
|
$password, # |
36
|
|
|
|
|
|
|
pack("H*", $self->salt), |
37
|
|
|
|
|
|
|
$self->n, |
38
|
|
|
|
|
|
|
$self->r, |
39
|
|
|
|
|
|
|
$self->p, |
40
|
|
|
|
|
|
|
$self->dklen |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
1810355
|
return $derived_key; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |