blib/lib/Crypt/Sodium/XS/pwhash.pm

filter: Statementstmt 89.6% 78 / 87 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.2% 26 / 32 Podpod 100% 1 / 1 totaltotal 87.5% 105 / 120 CC 1 SCAR 1.7
CC
1
Cov
90%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.2
« blib/lib/Crypt/Sodium/XS/secretstream.pm ↑ Summary blib/lib/Crypt/Sodium/XS/kem.pm »
1 package Crypt::Sodium::XS::pwhash;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Crypt::Sodium::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 _define_constants();
9  
10 {
11 3 my @constant_bases = qw(
12 BYTES_MAX
13 BYTES_MIN
14 MEMLIMIT_INTERACTIVE
15 MEMLIMIT_MAX
16 MEMLIMIT_MIN
17 MEMLIMIT_MODERATE
18 MEMLIMIT_SENSITIVE
19 OPSLIMIT_INTERACTIVE
20 OPSLIMIT_MAX
21 OPSLIMIT_MIN
22 OPSLIMIT_MODERATE
23 OPSLIMIT_SENSITIVE
24 PASSWD_MAX
25 PASSWD_MIN
26 SALTBYTES
27 STRBYTES
28 STRPREFIX
29 );
30  
31 3 my @bases = qw(
32 salt
33 str
34 str_needs_rehash
35 verify
36 );
37  
38 my $default = [
39 "pwhash",
40 12 (map { "pwhash_$_" } @bases),
41 3 (map { "pwhash_$_" } @constant_bases, "PRIMITIVE"),
42 ];
43 my $argon2i = [
44 "pwhash_argon2i",
45 12 (map { "pwhash_argon2i_$_" } @bases),
46 3 (map { "pwhash_argon2i_$_" } @constant_bases),
47 ];
48 my $argon2id = [
49 "pwhash_argon2id",
50 12 (map { "pwhash_argon2id_$_" } @bases),
51 3 (map { "pwhash_argon2id_$_" } @constant_bases),
52 ];
53 my $scryptsalsa208sha256 = [
54 "pwhash_scryptsalsa208sha256",
55 12 (map { "pwhash_scryptsalsa208sha256_$_" } @bases),
56 3 (map { "pwhash_scryptsalsa208sha256_$_" } @constant_bases),
57 ];
58  
59 3 our %EXPORT_TAGS = (
60 all => [ @$default, @$argon2i, @$argon2id, @$scryptsalsa208sha256, ],
61 default => $default,
62 argon2i => $argon2i,
63 argon2id => $argon2id,
64 scryptsalsa208sha256 => $scryptsalsa208sha256,
65 );
66  
67 3 our @EXPORT_OK = @{$EXPORT_TAGS{all}};
68 }
69  
70 package Crypt::Sodium::XS::OO::pwhash;
71 3 ▶use parent 'Crypt::Sodium::XS::OO::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 my %methods = (
74 default => {
75 BYTES_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_BYTES_MAX,
76 BYTES_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_BYTES_MIN,
77 MEMLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_MEMLIMIT_INTERACTIVE,
78 MEMLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_MEMLIMIT_MIN,
79 MEMLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_MEMLIMIT_MAX,
80 MEMLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_MEMLIMIT_MODERATE,
81 MEMLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_MEMLIMIT_SENSITIVE,
82 OPSLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_OPSLIMIT_INTERACTIVE,
83 OPSLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_OPSLIMIT_MIN,
84 OPSLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_OPSLIMIT_MAX,
85 OPSLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_OPSLIMIT_MODERATE,
86 OPSLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_OPSLIMIT_SENSITIVE,
87 PASSWD_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_PASSWD_MAX,
88 PASSWD_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_PASSWD_MIN,
89 PRIMITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_PRIMITIVE,
90 SALTBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_SALTBYTES,
91 STRBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_STRBYTES,
92 STRPREFIX => \&Crypt::Sodium::XS::pwhash::pwhash_STRPREFIX,
93 pwhash => \&Crypt::Sodium::XS::pwhash::pwhash,
94 salt => \&Crypt::Sodium::XS::pwhash::pwhash_salt,
95 str => \&Crypt::Sodium::XS::pwhash::pwhash_str,
96 str_needs_rehash => \&Crypt::Sodium::XS::pwhash::pwhash_str_needs_rehash,
97 verify => \&Crypt::Sodium::XS::pwhash::pwhash_verify,
98 },
99 argon2i => {
100 BYTES_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_BYTES_MAX,
101 BYTES_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_BYTES_MIN,
102 MEMLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_MEMLIMIT_INTERACTIVE,
103 MEMLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_MEMLIMIT_MIN,
104 MEMLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_MEMLIMIT_MAX,
105 MEMLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_MEMLIMIT_MODERATE,
106 MEMLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_MEMLIMIT_SENSITIVE,
107 OPSLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_OPSLIMIT_INTERACTIVE,
108 OPSLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_OPSLIMIT_MODERATE,
109 OPSLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_OPSLIMIT_MIN,
110 OPSLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_OPSLIMIT_MAX,
111 OPSLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_OPSLIMIT_SENSITIVE,
112 PASSWD_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_PASSWD_MAX,
113 PASSWD_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_PASSWD_MIN,
114 0 ▶ PRIMITIVE => sub { 'argon2i' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
115 SALTBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_SALTBYTES,
116 STRBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_STRBYTES,
117 STRPREFIX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_STRPREFIX,
118 pwhash => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i,
119 salt => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_salt,
120 str => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_str,
121 str_needs_rehash => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_str_needs_rehash,
122 verify => \&Crypt::Sodium::XS::pwhash::pwhash_argon2i_verify,
123 },
124 argon2id => {
125 BYTES_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_BYTES_MAX,
126 BYTES_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_BYTES_MIN,
127 MEMLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_MEMLIMIT_INTERACTIVE,
128 MEMLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_MEMLIMIT_MIN,
129 MEMLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_MEMLIMIT_MAX,
130 MEMLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_MEMLIMIT_MODERATE,
131 MEMLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_MEMLIMIT_SENSITIVE,
132 OPSLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_OPSLIMIT_INTERACTIVE,
133 OPSLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_OPSLIMIT_MIN,
134 OPSLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_OPSLIMIT_MAX,
135 OPSLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_OPSLIMIT_MODERATE,
136 OPSLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_OPSLIMIT_SENSITIVE,
137 PASSWD_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_PASSWD_MAX,
138 PASSWD_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_PASSWD_MIN,
139 0 ▶ PRIMITIVE => sub { 'argon2id' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
140 SALTBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_SALTBYTES,
141 STRBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_STRBYTES,
142 STRPREFIX => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_STRPREFIX,
143 pwhash => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id,
144 salt => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_salt,
145 str => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_str,
146 str_needs_rehash => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_str_needs_rehash,
147 verify => \&Crypt::Sodium::XS::pwhash::pwhash_argon2id_verify,
148 },
149 scryptsalsa208sha256 => {
150 BYTES_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_BYTES_MAX,
151 BYTES_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_BYTES_MIN,
152 MEMLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE,
153 MEMLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_MEMLIMIT_MIN,
154 MEMLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_MEMLIMIT_MAX,
155 MEMLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_MEMLIMIT_MODERATE,
156 MEMLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE,
157 OPSLIMIT_INTERACTIVE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE,
158 OPSLIMIT_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_OPSLIMIT_MIN,
159 OPSLIMIT_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_OPSLIMIT_MAX,
160 OPSLIMIT_MODERATE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_OPSLIMIT_MODERATE,
161 OPSLIMIT_SENSITIVE => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE,
162 PASSWD_MAX => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_PASSWD_MAX,
163 PASSWD_MIN => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_PASSWD_MIN,
164 0 ▶ PRIMITIVE => sub { 'scryptsalsa208sha256' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
165 3 SALTBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_SALTBYTES,
166 STRBYTES => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_STRBYTES,
167 STRPREFIX => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_STRPREFIX,
168 pwhash => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256,
169 salt => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_salt,
170 str => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_str,
171 str_needs_rehash => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_str_needs_rehash,
172 verify => \&Crypt::Sodium::XS::pwhash::pwhash_scryptsalsa208sha256_verify,
173 },
174 );
175  
176 6 ▶sub Crypt::Sodium::XS::pwhash::primitives { keys %methods }
Subroutine primitives: called CC=1 SCAR=0.0
Pod documented
177 3 *primitives = \&Crypt::Sodium::XS::pwhash::primitives;
178  
179 4 ▶sub BYTES_MAX { my $self = shift; goto $methods{$self->{primitive}}->{BYTES_MAX}; }
Subroutine BYTES_MAX: called CC=1 SCAR=0.0
180 0 ▶sub BYTES_MIN { my $self = shift; goto $methods{$self->{primitive}}->{BYTES_MIN}; }
Subroutine BYTES_MIN: not called CC=1 SCAR=6.9
181 28 ▶sub MEMLIMIT_INTERACTIVE { my $self = shift; goto $methods{$self->{primitive}}->{MEMLIMIT_INTERACTIVE}; }
Subroutine MEMLIMIT_INTERACTIVE: called CC=1 SCAR=0.0
182 4 ▶sub MEMLIMIT_MAX { my $self = shift; goto $methods{$self->{primitive}}->{MEMLIMIT_MAX}; }
Subroutine MEMLIMIT_MAX: called CC=1 SCAR=0.0
183 4 ▶sub MEMLIMIT_MIN { my $self = shift; goto $methods{$self->{primitive}}->{MEMLIMIT_MIN}; }
Subroutine MEMLIMIT_MIN: called CC=1 SCAR=0.0
184 10 ▶sub MEMLIMIT_MODERATE { my $self = shift; goto $methods{$self->{primitive}}->{MEMLIMIT_MODERATE}; }
Subroutine MEMLIMIT_MODERATE: called CC=1 SCAR=0.0
185 12 ▶sub MEMLIMIT_SENSITIVE { my $self = shift; goto $methods{$self->{primitive}}->{MEMLIMIT_SENSITIVE}; }
Subroutine MEMLIMIT_SENSITIVE: called CC=1 SCAR=0.0
186 28 ▶sub OPSLIMIT_INTERACTIVE { my $self = shift; goto $methods{$self->{primitive}}->{OPSLIMIT_INTERACTIVE}; }
Subroutine OPSLIMIT_INTERACTIVE: called CC=1 SCAR=0.0
187 4 ▶sub OPSLIMIT_MAX { my $self = shift; goto $methods{$self->{primitive}}->{OPSLIMIT_MAX}; }
Subroutine OPSLIMIT_MAX: called CC=1 SCAR=0.0
188 4 ▶sub OPSLIMIT_MIN { my $self = shift; goto $methods{$self->{primitive}}->{OPSLIMIT_MIN}; }
Subroutine OPSLIMIT_MIN: called CC=1 SCAR=0.0
189 10 ▶sub OPSLIMIT_MODERATE { my $self = shift; goto $methods{$self->{primitive}}->{OPSLIMIT_MODERATE}; }
Subroutine OPSLIMIT_MODERATE: called CC=1 SCAR=0.0
190 12 ▶sub OPSLIMIT_SENSITIVE { my $self = shift; goto $methods{$self->{primitive}}->{OPSLIMIT_SENSITIVE}; }
Subroutine OPSLIMIT_SENSITIVE: called CC=1 SCAR=0.0
191 4 ▶sub PASSWD_MAX { my $self = shift; goto $methods{$self->{primitive}}->{PASSWD_MAX}; }
Subroutine PASSWD_MAX: called CC=1 SCAR=0.0
192 0 ▶sub PASSWD_MIN { my $self = shift; goto $methods{$self->{primitive}}->{PASSWD_MIN}; }
Subroutine PASSWD_MIN: not called CC=1 SCAR=6.9
193 1 ▶sub PRIMITIVE { my $self = shift; goto $methods{$self->{primitive}}->{PRIMITIVE}; }
Subroutine PRIMITIVE: called CC=1 SCAR=0.0
194 4 ▶sub SALTBYTES { my $self = shift; goto $methods{$self->{primitive}}->{SALTBYTES}; }
Subroutine SALTBYTES: called CC=1 SCAR=0.0
195 4 ▶sub STRBYTES { my $self = shift; goto $methods{$self->{primitive}}->{STRBYTES}; }
Subroutine STRBYTES: called CC=1 SCAR=0.0
196 4 ▶sub STRPREFIX { my $self = shift; goto $methods{$self->{primitive}}->{STRPREFIX}; }
Subroutine STRPREFIX: called CC=1 SCAR=0.0
197 32 ▶sub pwhash { my $self = shift; goto $methods{$self->{primitive}}->{pwhash}; }
Subroutine pwhash: called CC=1 SCAR=0.0
198 8 ▶sub salt { my $self = shift; goto $methods{$self->{primitive}}->{salt}; }
Subroutine salt: called CC=1 SCAR=0.0
199 16 ▶sub str { my $self = shift; goto $methods{$self->{primitive}}->{str}; }
Subroutine str: called CC=1 SCAR=0.0
200 0 ▶sub str_needs_rehash { my $self = shift; goto $methods{$self->{primitive}}->{str_needs_rehash}; }
Subroutine str_needs_rehash: not called CC=1 SCAR=6.9
201 16 ▶sub verify { my $self = shift; goto $methods{$self->{primitive}}->{verify}; }
Subroutine verify: called CC=1 SCAR=0.0
202  
203 3 1;
204  
205 __END__
« blib/lib/Crypt/Sodium/XS/secretstream.pm ↑ Summary blib/lib/Crypt/Sodium/XS/kem.pm »