line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
54
|
|
|
54
|
|
1132424
|
use strict; |
|
54
|
|
|
|
|
119
|
|
|
54
|
|
|
|
|
1452
|
|
2
|
54
|
|
|
54
|
|
278
|
use warnings; |
|
54
|
|
|
|
|
93
|
|
|
54
|
|
|
|
|
3515
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#ABSTRACT: NaCl compatible modern, easy-to-use library for encryption, decryption, signatures, password hashing and more |
5
|
|
|
|
|
|
|
package Crypt::NaCl::Sodium; |
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:AJGB'; |
7
|
|
|
|
|
|
|
$Crypt::NaCl::Sodium::VERSION = '1.0.8.0'; |
8
|
54
|
|
|
54
|
|
275
|
use Carp qw( croak ); |
|
54
|
|
|
|
|
104
|
|
|
54
|
|
|
|
|
3683
|
|
9
|
54
|
|
|
54
|
|
47725
|
use Sub::Exporter; |
|
54
|
|
|
|
|
786817
|
|
|
54
|
|
|
|
|
348
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require XSLoader; |
12
|
|
|
|
|
|
|
XSLoader::load('Crypt::NaCl::Sodium', $Crypt::NaCl::Sodium::{VERSION} ? |
13
|
|
|
|
|
|
|
${ $Crypt::NaCl::Sodium::{VERSION} } : () |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @funcs = qw( |
17
|
|
|
|
|
|
|
bin2hex hex2bin |
18
|
|
|
|
|
|
|
memcmp compare memzero |
19
|
|
|
|
|
|
|
increment |
20
|
|
|
|
|
|
|
random_bytes |
21
|
|
|
|
|
|
|
random_number |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Sub::Exporter::setup_exporter( |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
exports => \@funcs, |
27
|
|
|
|
|
|
|
groups => { |
28
|
|
|
|
|
|
|
all => \@funcs, |
29
|
|
|
|
|
|
|
utils => \@funcs, |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
1
|
|
|
1
|
1
|
11
|
my ($proto, $submodule) = @_; |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
|
|
|
5
|
if ( ! $submodule ) { |
38
|
1
|
|
|
|
|
1
|
my $o = 0; |
39
|
1
|
|
|
|
|
21
|
return bless \$o, $proto; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
0
|
if ( my $m = $proto->can($submodule) ) { |
43
|
0
|
|
|
|
|
0
|
return $m->(); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
croak "Unknown submodule $submodule\n"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub secretbox { |
50
|
5
|
|
|
5
|
1
|
395
|
return Crypt::NaCl::Sodium::secretbox->new(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub auth { |
54
|
8
|
|
|
8
|
1
|
766
|
return Crypt::NaCl::Sodium::auth->new(); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub aead { |
58
|
6
|
|
|
6
|
1
|
1087
|
return Crypt::NaCl::Sodium::aead->new(); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub box { |
62
|
5
|
|
|
5
|
1
|
362
|
return Crypt::NaCl::Sodium::box->new(); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub sign { |
66
|
4
|
|
|
4
|
1
|
376
|
return Crypt::NaCl::Sodium::sign->new(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub generichash { |
70
|
5
|
|
|
5
|
1
|
363
|
return Crypt::NaCl::Sodium::generichash->new(); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub shorthash { |
74
|
4
|
|
|
4
|
1
|
385
|
return Crypt::NaCl::Sodium::shorthash->new(); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub pwhash { |
78
|
4
|
|
|
4
|
1
|
387
|
return Crypt::NaCl::Sodium::pwhash->new(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub hash { |
82
|
8
|
|
|
8
|
1
|
404
|
return Crypt::NaCl::Sodium::hash->new(); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub onetimeauth { |
86
|
5
|
|
|
5
|
1
|
607
|
return Crypt::NaCl::Sodium::onetimeauth->new(); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub scalarmult { |
90
|
5
|
|
|
5
|
1
|
30560
|
return Crypt::NaCl::Sodium::scalarmult->new(); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub stream { |
94
|
8
|
|
|
8
|
1
|
426
|
return Crypt::NaCl::Sodium::stream->new(); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
package |
98
|
|
|
|
|
|
|
Data::BytesLocker; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
our $DEFAULT_LOCKED = 0; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
package |
103
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::secretbox; |
104
|
|
|
|
|
|
|
|
105
|
5
|
|
|
5
|
|
22
|
sub new { return bless {}, __PACKAGE__ } |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
package |
108
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::auth; |
109
|
|
|
|
|
|
|
|
110
|
8
|
|
|
8
|
|
38
|
sub new { return bless {}, __PACKAGE__ } |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
package |
113
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::aead; |
114
|
|
|
|
|
|
|
|
115
|
6
|
|
|
6
|
|
28
|
sub new { return bless {}, __PACKAGE__ } |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
package |
118
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::box; |
119
|
|
|
|
|
|
|
|
120
|
5
|
|
|
5
|
|
22
|
sub new { return bless {}, __PACKAGE__ } |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
package |
123
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::sign; |
124
|
|
|
|
|
|
|
|
125
|
4
|
|
|
4
|
|
20
|
sub new { return bless {}, __PACKAGE__ } |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
package |
128
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::generichash; |
129
|
|
|
|
|
|
|
|
130
|
5
|
|
|
5
|
|
22
|
sub new { return bless {}, __PACKAGE__ } |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
package |
133
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::shorthash; |
134
|
|
|
|
|
|
|
|
135
|
4
|
|
|
4
|
|
20
|
sub new { return bless {}, __PACKAGE__ } |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
package |
138
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::pwhash; |
139
|
|
|
|
|
|
|
|
140
|
4
|
|
|
4
|
|
17
|
sub new { return bless {}, __PACKAGE__ } |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
package |
143
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::hash; |
144
|
|
|
|
|
|
|
|
145
|
8
|
|
|
8
|
|
35
|
sub new { return bless {}, __PACKAGE__ } |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
package |
148
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::onetimeauth; |
149
|
|
|
|
|
|
|
|
150
|
5
|
|
|
5
|
|
23
|
sub new { return bless {}, __PACKAGE__ } |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
package |
153
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::scalarmult; |
154
|
|
|
|
|
|
|
|
155
|
5
|
|
|
5
|
|
40
|
sub new { return bless {}, __PACKAGE__ } |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
package |
158
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::stream; |
159
|
|
|
|
|
|
|
|
160
|
8
|
|
|
8
|
|
38
|
sub new { return bless {}, __PACKAGE__ } |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
1; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__END__ |