| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Crypt::Mac::PMAC; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! |
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
107249
|
use strict; |
|
|
3
|
|
|
|
|
18
|
|
|
|
3
|
|
|
|
|
70
|
|
|
6
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
120
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.080'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
14
|
use base qw(Crypt::Mac Exporter); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
1140
|
|
|
10
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] ); |
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Crypt::Mac::PMAC - Message authentication code PMAC |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
### Functional interface: |
|
25
|
|
|
|
|
|
|
use Crypt::Mac::PMAC qw( pmac pmac_hex ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# calculate MAC from string/buffer |
|
28
|
|
|
|
|
|
|
$pmac_raw = pmac($cipher_name, $key, 'data buffer'); |
|
29
|
|
|
|
|
|
|
$pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); |
|
30
|
|
|
|
|
|
|
$pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); |
|
31
|
|
|
|
|
|
|
$pmac_b64u = pmac_b64u($cipher_name, $key, 'data buffer'); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
### OO interface: |
|
34
|
|
|
|
|
|
|
use Crypt::Mac::PMAC; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$d = Crypt::Mac::PMAC->new($cipher_name, $key); |
|
37
|
|
|
|
|
|
|
$d->add('any data'); |
|
38
|
|
|
|
|
|
|
$d->addfile('filename.dat'); |
|
39
|
|
|
|
|
|
|
$d->addfile(*FILEHANDLE); |
|
40
|
|
|
|
|
|
|
$result_raw = $d->mac; # raw bytes |
|
41
|
|
|
|
|
|
|
$result_hex = $d->hexmac; # hexadecimal form |
|
42
|
|
|
|
|
|
|
$result_b64 = $d->b64mac; # Base64 form |
|
43
|
|
|
|
|
|
|
$result_b64u = $d->b64umac; # Base64 URL Safe form |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Provides an interface to the PMAC message authentication code (MAC) algorithm. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 EXPORT |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Nothing is exported by default. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
You can export selected functions: |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use Crypt::Mac::PMAC qw(pmac pmac_hex ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Or all of them at once: |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Crypt::Mac::PMAC ':all'; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 pmac |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a binary string. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$pmac_raw = pmac($cipher_name, $key, 'data buffer'); |
|
68
|
|
|
|
|
|
|
#or |
|
69
|
|
|
|
|
|
|
$pmac_raw = pmac($cipher_name, $key, 'any data', 'more data', 'even more data'); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 pmac_hex |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a hexadecimal string. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); |
|
76
|
|
|
|
|
|
|
#or |
|
77
|
|
|
|
|
|
|
$pmac_hex = pmac_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 pmac_b64 |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 string. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); |
|
84
|
|
|
|
|
|
|
#or |
|
85
|
|
|
|
|
|
|
$pmac_b64 = pmac_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 pmac_b64u |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$pmac_b64url = pmac_b64u($cipher_name, $key, 'data buffer'); |
|
92
|
|
|
|
|
|
|
#or |
|
93
|
|
|
|
|
|
|
$pmac_b64url = pmac_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 METHODS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 new |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$d = Crypt::Mac::PMAC->new($cipher_name, $key); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 clone |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
$d->clone(); |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 reset |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$d->reset(); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 add |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$d->add('any data'); |
|
112
|
|
|
|
|
|
|
#or |
|
113
|
|
|
|
|
|
|
$d->add('any data', 'more data', 'even more data'); |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 addfile |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$d->addfile('filename.dat'); |
|
118
|
|
|
|
|
|
|
#or |
|
119
|
|
|
|
|
|
|
$d->addfile(*FILEHANDLE); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 mac |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$result_raw = $d->mac(); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 hexmac |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$result_hex = $d->hexmac(); |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 b64mac |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$result_b64 = $d->b64mac(); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 b64umac |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$result_b64url = $d->b64umac(); |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * L |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * L |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |