line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
54
|
|
|
54
|
|
1124383
|
use strict; |
|
54
|
|
|
|
|
121
|
|
|
54
|
|
|
|
|
1441
|
|
2
|
54
|
|
|
54
|
|
282
|
use warnings; |
|
54
|
|
|
|
|
88
|
|
|
54
|
|
|
|
|
3552
|
|
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.6.1'; |
8
|
54
|
|
|
54
|
|
320
|
use Carp qw( croak ); |
|
54
|
|
|
|
|
100
|
|
|
54
|
|
|
|
|
3694
|
|
9
|
54
|
|
|
54
|
|
47092
|
use Sub::Exporter; |
|
54
|
|
|
|
|
740233
|
|
|
54
|
|
|
|
|
336
|
|
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
|
14
|
my ($proto, $submodule) = @_; |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
|
|
|
5
|
if ( ! $submodule ) { |
38
|
1
|
|
|
|
|
3
|
my $o = 0; |
39
|
1
|
|
|
|
|
5
|
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
|
404
|
return Crypt::NaCl::Sodium::secretbox->new(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub auth { |
54
|
8
|
|
|
8
|
1
|
748
|
return Crypt::NaCl::Sodium::auth->new(); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub aead { |
58
|
6
|
|
|
6
|
1
|
1094
|
return Crypt::NaCl::Sodium::aead->new(); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub box { |
62
|
5
|
|
|
5
|
1
|
368
|
return Crypt::NaCl::Sodium::box->new(); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub sign { |
66
|
4
|
|
|
4
|
1
|
387
|
return Crypt::NaCl::Sodium::sign->new(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub generichash { |
70
|
5
|
|
|
5
|
1
|
365
|
return Crypt::NaCl::Sodium::generichash->new(); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub shorthash { |
74
|
4
|
|
|
4
|
1
|
410
|
return Crypt::NaCl::Sodium::shorthash->new(); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub pwhash { |
78
|
4
|
|
|
4
|
1
|
369
|
return Crypt::NaCl::Sodium::pwhash->new(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub hash { |
82
|
8
|
|
|
8
|
1
|
454
|
return Crypt::NaCl::Sodium::hash->new(); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub onetimeauth { |
86
|
5
|
|
|
5
|
1
|
652
|
return Crypt::NaCl::Sodium::onetimeauth->new(); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub scalarmult { |
90
|
5
|
|
|
5
|
1
|
32327
|
return Crypt::NaCl::Sodium::scalarmult->new(); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub stream { |
94
|
8
|
|
|
8
|
1
|
420
|
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
|
|
24
|
sub new { return bless {}, __PACKAGE__ } |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
package |
108
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::auth; |
109
|
|
|
|
|
|
|
|
110
|
8
|
|
|
8
|
|
36
|
sub new { return bless {}, __PACKAGE__ } |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
package |
113
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::aead; |
114
|
|
|
|
|
|
|
|
115
|
6
|
|
|
6
|
|
31
|
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
|
|
18
|
sub new { return bless {}, __PACKAGE__ } |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
package |
128
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::generichash; |
129
|
|
|
|
|
|
|
|
130
|
5
|
|
|
5
|
|
21
|
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
|
|
16
|
sub new { return bless {}, __PACKAGE__ } |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
package |
143
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::hash; |
144
|
|
|
|
|
|
|
|
145
|
8
|
|
|
8
|
|
36
|
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
|
|
22
|
sub new { return bless {}, __PACKAGE__ } |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
package |
158
|
|
|
|
|
|
|
Crypt::NaCl::Sodium::stream; |
159
|
|
|
|
|
|
|
|
160
|
8
|
|
|
8
|
|
37
|
sub new { return bless {}, __PACKAGE__ } |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
1; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__END__ |