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

filter: Statementstmt 90.9% 50 / 55 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 12 / 16 Podpod 100% 1 / 1 totaltotal 87.5% 63 / 72 CC 1 SCAR 2.2
CC
1
Cov
91%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.2
« blib/lib/Crypt/Sodium/XS/hkdf.pm ↑ Summary blib/lib/Crypt/Sodium/XS/box.pm »
1 package Crypt::Sodium::XS::auth;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Crypt::Sodium::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 _define_constants();
9  
10 {
11 1 my @constant_bases = qw(
12 BYTES
13 KEYBYTES
14 );
15  
16 1 my @bases = qw(
17 init
18 keygen
19 verify
20 );
21  
22 my $default = [
23 "auth",
24 3 (map { "auth_$_" } @bases),
25 1 (map { "auth_$_" } @constant_bases, "PRIMITIVE"),
26 ];
27 my $hmacsha256 = [
28 "auth_hmacsha256",
29 3 (map { "auth_hmacsha256_$_" } @bases),
30 1 (map { "auth_hmacsha256_$_" } @constant_bases),
31 ];
32 my $hmacsha512 = [
33 "auth_hmacsha512",
34 3 (map { "auth_hmacsha512_$_" } @bases),
35 1 (map { "auth_hmacsha512_$_" } @constant_bases),
36 ];
37 my $hmacsha512256 = [
38 "auth_hmacsha512256",
39 3 (map { "auth_hmacsha512256_$_" } @bases),
40 1 (map { "auth_hmacsha512256_$_" } @constant_bases),
41 ];
42  
43 1 our %EXPORT_TAGS = (
44 all => [ @$default, @$hmacsha256, @$hmacsha512, @$hmacsha512256 ],
45 default => $default,
46 hmacsha256 => $hmacsha256,
47 hmacsha512 => $hmacsha512,
48 hmacsha512256 => $hmacsha512256,
49 );
50  
51 1 our @EXPORT_OK = @{$EXPORT_TAGS{all}};
52 }
53  
54 package Crypt::Sodium::XS::OO::auth;
55 1 ▶use parent 'Crypt::Sodium::XS::OO::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
56  
57 my %methods = (
58 default => {
59 BYTES => \&Crypt::Sodium::XS::auth::auth_BYTES,
60 KEYBYTES => \&Crypt::Sodium::XS::auth::auth_KEYBYTES,
61 PRIMITIVE => \&Crypt::Sodium::XS::auth::auth_PRIMITIVE,
62 auth => \&Crypt::Sodium::XS::auth::auth,
63 init => \&Crypt::Sodium::XS::auth::auth_init,
64 keygen => \&Crypt::Sodium::XS::auth::auth_keygen,
65 verify => \&Crypt::Sodium::XS::auth::auth_verify,
66 },
67 hmacsha256 => {
68 BYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha256_BYTES,
69 KEYBYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha256_KEYBYTES,
70 0 ▶ PRIMITVE => sub { 'hmacsha256' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
71 auth => \&Crypt::Sodium::XS::auth::auth_hmacsha256,
72 init => \&Crypt::Sodium::XS::auth::auth_hmacsha256_init,
73 keygen => \&Crypt::Sodium::XS::auth::auth_hmacsha256_keygen,
74 verify => \&Crypt::Sodium::XS::auth::auth_hmacsha256_verify,
75 },
76 hmacsha512 => {
77 BYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha512_BYTES,
78 KEYBYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha512_KEYBYTES,
79 0 ▶ PRIMITVE => sub { 'hmacsha512' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
80 auth => \&Crypt::Sodium::XS::auth::auth_hmacsha512,
81 init => \&Crypt::Sodium::XS::auth::auth_hmacsha512_init,
82 keygen => \&Crypt::Sodium::XS::auth::auth_hmacsha512_keygen,
83 verify => \&Crypt::Sodium::XS::auth::auth_hmacsha512_verify,
84 },
85 hmacsha512256 => {
86 BYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha512256_BYTES,
87 KEYBYTES => \&Crypt::Sodium::XS::auth::auth_hmacsha512256_KEYBYTES,
88 0 ▶ PRIMITVE => sub { 'hmacsha512256' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
89 1 auth => \&Crypt::Sodium::XS::auth::auth_hmacsha512256,
90 init => \&Crypt::Sodium::XS::auth::auth_hmacsha512256_init,
91 keygen => \&Crypt::Sodium::XS::auth::auth_hmacsha512256_keygen,
92 verify => \&Crypt::Sodium::XS::auth::auth_hmacsha512256_verify,
93 },
94 );
95  
96 5 ▶sub Crypt::Sodium::XS::auth::primitives { keys %methods }
Subroutine primitives: called CC=1 SCAR=0.0
Pod documented
97 1 *primitives = \&Crypt::Sodium::XS::auth::primitives;
98  
99 4 ▶sub BYTES { my $self = shift; goto $methods{$self->{primitive}}->{BYTES}; }
Subroutine BYTES: called CC=1 SCAR=0.0
100 61 ▶sub KEYBYTES { my $self = shift; goto $methods{$self->{primitive}}->{KEYBYTES}; }
Subroutine KEYBYTES: called CC=1 SCAR=0.0
101 0 ▶sub PRIMITIVE { my $self = shift; goto $methods{$self->{primitive}}->{PRIMITIVE}; }
Subroutine PRIMITIVE: not called CC=1 SCAR=6.9
102 8 ▶sub auth { my $self = shift; goto $methods{$self->{primitive}}->{auth}; }
Subroutine auth: called CC=1 SCAR=0.0
103 148 ▶sub init { my $self = shift; goto $methods{$self->{primitive}}->{init}; }
Subroutine init: called CC=1 SCAR=0.0
104 8 ▶sub keygen { my $self = shift; goto $methods{$self->{primitive}}->{keygen}; }
Subroutine keygen: called CC=1 SCAR=0.0
105 156 ▶sub verify { my $self = shift; goto $methods{$self->{primitive}}->{verify}; }
Subroutine verify: called CC=1 SCAR=0.0
106  
107 1 1;
108  
109 __END__
« blib/lib/Crypt/Sodium/XS/hkdf.pm ↑ Summary blib/lib/Crypt/Sodium/XS/box.pm »