| 1 | package Crypt::NaCl::Sodium; | ||||||||||
| 2 | |||||||||||
| 3 | 54 | our $VERSION = '2.004'; | |||||||||
| 4 | 54 | our $XS_VERSION = $VERSION; | |||||||||
| 5 | |||||||||||
| 6 | 54 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 54 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 54 | ▶ | use Carp qw( croak ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 54 | ▶ | use Sub::Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 54 | require XSLoader; | |||||||||
| 13 | 54 | XSLoader::load('Crypt::NaCl::Sodium', $XS_VERSION); | |||||||||
| 14 | |||||||||||
| 15 | 54 | my @funcs = qw( | |||||||||
| 16 | bin2hex hex2bin | ||||||||||
| 17 | memcmp compare memzero | ||||||||||
| 18 | increment | ||||||||||
| 19 | random_bytes | ||||||||||
| 20 | random_number | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | 54 | Sub::Exporter::setup_exporter( | |||||||||
| 24 | { | ||||||||||
| 25 | exports => \@funcs, | ||||||||||
| 26 | groups => { | ||||||||||
| 27 | all => \@funcs, | ||||||||||
| 28 | utils => \@funcs, | ||||||||||
| 29 | } | ||||||||||
| 30 | } | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=15.0
Pod
documented
| |||||||||||
| 34 | 2 | my ($proto, $submodule) = @_; | |||||||||
| 35 | |||||||||||
| 36 | 2 | ▶ | if ( ! $submodule ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 2 | my $o = 0; | |||||||||
| 38 | 2 | return bless \$o, $proto; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | if ( my $m = $proto->can($submodule) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | return $m->(); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | croak "Unknown submodule $submodule\n"; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 5 | ▶ | sub secretbox { | ||||||||
|
Subroutine
secretbox: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | 5 | return Crypt::NaCl::Sodium::secretbox->new(); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 8 | ▶ | sub auth { | ||||||||
|
Subroutine
auth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 53 | 8 | return Crypt::NaCl::Sodium::auth->new(); | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 6 | ▶ | sub aead { | ||||||||
|
Subroutine
aead: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | 6 | return Crypt::NaCl::Sodium::aead->new(); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 5 | ▶ | sub box { | ||||||||
|
Subroutine
box: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 61 | 5 | return Crypt::NaCl::Sodium::box->new(); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 4 | ▶ | sub sign { | ||||||||
|
Subroutine
sign: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 65 | 4 | return Crypt::NaCl::Sodium::sign->new(); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 5 | ▶ | sub generichash { | ||||||||
|
Subroutine
generichash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 69 | 5 | return Crypt::NaCl::Sodium::generichash->new(); | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 4 | ▶ | sub shorthash { | ||||||||
|
Subroutine
shorthash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 73 | 4 | return Crypt::NaCl::Sodium::shorthash->new(); | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 4 | ▶ | sub pwhash { | ||||||||
|
Subroutine
pwhash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 77 | 4 | return Crypt::NaCl::Sodium::pwhash->new(); | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 8 | ▶ | sub hash { | ||||||||
|
Subroutine
hash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 81 | 8 | return Crypt::NaCl::Sodium::hash->new(); | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 5 | ▶ | sub onetimeauth { | ||||||||
|
Subroutine
onetimeauth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 85 | 5 | return Crypt::NaCl::Sodium::onetimeauth->new(); | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 5 | ▶ | sub scalarmult { | ||||||||
|
Subroutine
scalarmult: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 89 | 5 | return Crypt::NaCl::Sodium::scalarmult->new(); | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | 8 | ▶ | sub stream { | ||||||||
|
Subroutine
stream: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 93 | 8 | return Crypt::NaCl::Sodium::stream->new(); | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | package | ||||||||||
| 97 | Data::BytesLocker; | ||||||||||
| 98 | |||||||||||
| 99 | 54 | our $DEFAULT_LOCKED = 0; | |||||||||
| 100 | |||||||||||
| 101 | package | ||||||||||
| 102 | Crypt::NaCl::Sodium::secretbox; | ||||||||||
| 103 | |||||||||||
| 104 | 5 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 105 | |||||||||||
| 106 | package | ||||||||||
| 107 | Crypt::NaCl::Sodium::auth; | ||||||||||
| 108 | |||||||||||
| 109 | 8 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 110 | |||||||||||
| 111 | package | ||||||||||
| 112 | Crypt::NaCl::Sodium::aead; | ||||||||||
| 113 | |||||||||||
| 114 | 6 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 115 | |||||||||||
| 116 | package | ||||||||||
| 117 | Crypt::NaCl::Sodium::box; | ||||||||||
| 118 | |||||||||||
| 119 | 5 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 120 | |||||||||||
| 121 | package | ||||||||||
| 122 | Crypt::NaCl::Sodium::sign; | ||||||||||
| 123 | |||||||||||
| 124 | 4 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 125 | |||||||||||
| 126 | package | ||||||||||
| 127 | Crypt::NaCl::Sodium::generichash; | ||||||||||
| 128 | |||||||||||
| 129 | 5 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 130 | |||||||||||
| 131 | package | ||||||||||
| 132 | Crypt::NaCl::Sodium::shorthash; | ||||||||||
| 133 | |||||||||||
| 134 | 4 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 135 | |||||||||||
| 136 | package | ||||||||||
| 137 | Crypt::NaCl::Sodium::pwhash; | ||||||||||
| 138 | |||||||||||
| 139 | 4 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 140 | |||||||||||
| 141 | package | ||||||||||
| 142 | Crypt::NaCl::Sodium::hash; | ||||||||||
| 143 | |||||||||||
| 144 | 8 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 145 | |||||||||||
| 146 | package | ||||||||||
| 147 | Crypt::NaCl::Sodium::onetimeauth; | ||||||||||
| 148 | |||||||||||
| 149 | 5 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 150 | |||||||||||
| 151 | package | ||||||||||
| 152 | Crypt::NaCl::Sodium::scalarmult; | ||||||||||
| 153 | |||||||||||
| 154 | 5 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 155 | |||||||||||
| 156 | package | ||||||||||
| 157 | Crypt::NaCl::Sodium::stream; | ||||||||||
| 158 | |||||||||||
| 159 | 8 | ▶ | sub new { return bless {}, __PACKAGE__ } | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||
| 160 | |||||||||||
| 161 | |||||||||||
| 162 | 54 | 1; | |||||||||
| 163 | |||||||||||
| 164 | __END__ | ||||||||||