| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Crypt::Digest::SHA512_224; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1242
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
66
|
|
|
6
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
118
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.089'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use base qw(Crypt::Digest Exporter); |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
528
|
|
|
10
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [qw( sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u )] ); |
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(); |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
185
|
|
|
15
|
|
|
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++; |
|
16
|
2
|
|
|
2
|
|
11
|
use Crypt::Digest; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
842
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
21
|
|
|
21
|
1
|
9964
|
my ($class) = @_; |
|
20
|
21
|
|
|
|
|
165
|
my $obj = Crypt::Digest->new('SHA512_224'); |
|
21
|
21
|
|
|
|
|
237
|
return bless $obj, $class; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub clone { |
|
25
|
3
|
|
|
3
|
1
|
483
|
my ($self) = @_; |
|
26
|
3
|
|
|
|
|
54
|
my $obj = Crypt::Digest::clone($self); |
|
27
|
3
|
|
33
|
|
|
19
|
return bless $obj, ref($self) || $self; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
1
|
194703
|
sub hashsize { Crypt::Digest::hashsize('SHA512_224') } |
|
31
|
4
|
|
|
4
|
1
|
944
|
sub sha512_224 { Crypt::Digest::digest_data('SHA512_224', @_) } |
|
32
|
4
|
|
|
4
|
1
|
50
|
sub sha512_224_hex { Crypt::Digest::digest_data_hex('SHA512_224', @_) } |
|
33
|
4
|
|
|
4
|
1
|
57
|
sub sha512_224_b64 { Crypt::Digest::digest_data_b64('SHA512_224', @_) } |
|
34
|
1
|
|
|
1
|
1
|
14
|
sub sha512_224_b64u { Crypt::Digest::digest_data_b64u('SHA512_224', @_) } |
|
35
|
4
|
|
|
4
|
1
|
25
|
sub sha512_224_file { Crypt::Digest::digest_file('SHA512_224', @_) } |
|
36
|
4
|
|
|
4
|
1
|
18
|
sub sha512_224_file_hex { Crypt::Digest::digest_file_hex('SHA512_224', @_) } |
|
37
|
4
|
|
|
4
|
1
|
16
|
sub sha512_224_file_b64 { Crypt::Digest::digest_file_b64('SHA512_224', @_) } |
|
38
|
0
|
|
|
0
|
1
|
|
sub sha512_224_file_b64u { Crypt::Digest::digest_file_b64u('SHA512_224', @_) } |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Crypt::Digest::SHA512_224 - Hash function SHA-512/224 [size: 224 bits] |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
### Functional interface: |
|
51
|
|
|
|
|
|
|
use Crypt::Digest::SHA512_224 qw( sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u |
|
52
|
|
|
|
|
|
|
sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u ); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# calculate digest from string/buffer |
|
55
|
|
|
|
|
|
|
my $data = 'data string'; |
|
56
|
|
|
|
|
|
|
my $sha512_224_raw = sha512_224($data); |
|
57
|
|
|
|
|
|
|
my $sha512_224_hex = sha512_224_hex($data); |
|
58
|
|
|
|
|
|
|
my $sha512_224_b64 = sha512_224_b64($data); |
|
59
|
|
|
|
|
|
|
my $sha512_224_b64u = sha512_224_b64u($data); |
|
60
|
|
|
|
|
|
|
# or from file |
|
61
|
|
|
|
|
|
|
my $sha512_224_file_raw = sha512_224_file('filename.dat'); |
|
62
|
|
|
|
|
|
|
my $sha512_224_file_hex = sha512_224_file_hex('filename.dat'); |
|
63
|
|
|
|
|
|
|
my $sha512_224_file_b64 = sha512_224_file_b64('filename.dat'); |
|
64
|
|
|
|
|
|
|
my $sha512_224_file_b64u = sha512_224_file_b64u('filename.dat'); |
|
65
|
|
|
|
|
|
|
# or from filehandle |
|
66
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
67
|
|
|
|
|
|
|
my $sha512_224_fh_raw = sha512_224_file($filehandle); |
|
68
|
|
|
|
|
|
|
my $sha512_224_fh_hex = sha512_224_file_hex($filehandle); |
|
69
|
|
|
|
|
|
|
my $sha512_224_fh_b64 = sha512_224_file_b64($filehandle); |
|
70
|
|
|
|
|
|
|
my $sha512_224_fh_b64u = sha512_224_file_b64u($filehandle); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
### OO interface: |
|
73
|
|
|
|
|
|
|
use Crypt::Digest::SHA512_224; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $d = Crypt::Digest::SHA512_224->new; |
|
76
|
|
|
|
|
|
|
$d->add('any data'); |
|
77
|
|
|
|
|
|
|
my $result_raw = $d->digest; # raw bytes |
|
78
|
|
|
|
|
|
|
my $result_hex = $d->hexdigest; # hexadecimal form |
|
79
|
|
|
|
|
|
|
my $result_b64 = $d->b64digest; # Base64 form |
|
80
|
|
|
|
|
|
|
my $result_b64u = $d->b64udigest; # Base64 URL-safe form |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# or hash a file instead |
|
83
|
|
|
|
|
|
|
my $file_result_raw = Crypt::Digest::SHA512_224->new->addfile('filename.dat')->digest; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Provides an interface to the SHA512_224 digest algorithm. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 EXPORT |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Nothing is exported by default. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
You can export selected functions: |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
use Crypt::Digest::SHA512_224 qw(sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u |
|
96
|
|
|
|
|
|
|
sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Or all of them at once: |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
use Crypt::Digest::SHA512_224 ':all'; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 sha512_224 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Joins all arguments into a single string and returns its SHA512_224 digest encoded as a binary string. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Data arguments for the functional helpers are converted to byte strings using |
|
109
|
|
|
|
|
|
|
Perl's usual scalar stringification. Defined scalars, including numbers and |
|
110
|
|
|
|
|
|
|
string-overloaded objects, are accepted. C is treated as an empty |
|
111
|
|
|
|
|
|
|
string and may emit Perl's usual "uninitialized value" warning. The same |
|
112
|
|
|
|
|
|
|
rules apply to C, C, and |
|
113
|
|
|
|
|
|
|
C. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $sha512_224_raw = sha512_224('data string'); |
|
116
|
|
|
|
|
|
|
#or |
|
117
|
|
|
|
|
|
|
my $sha512_224_raw = sha512_224('any data', 'more data', 'even more data'); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 sha512_224_hex |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Joins all arguments into a single string and returns its SHA512_224 digest encoded as a hexadecimal string. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my $sha512_224_hex = sha512_224_hex('data string'); |
|
124
|
|
|
|
|
|
|
#or |
|
125
|
|
|
|
|
|
|
my $sha512_224_hex = sha512_224_hex('any data', 'more data', 'even more data'); |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 sha512_224_b64 |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Joins all arguments into a single string and returns its SHA512_224 digest encoded as a Base64 string, B trailing '=' padding. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my $sha512_224_b64 = sha512_224_b64('data string'); |
|
132
|
|
|
|
|
|
|
#or |
|
133
|
|
|
|
|
|
|
my $sha512_224_b64 = sha512_224_b64('any data', 'more data', 'even more data'); |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 sha512_224_b64u |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Joins all arguments into a single string and returns its SHA512_224 digest encoded as a Base64 URL-safe string (see RFC 4648 section 5). |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my $sha512_224_b64url = sha512_224_b64u('data string'); |
|
140
|
|
|
|
|
|
|
#or |
|
141
|
|
|
|
|
|
|
my $sha512_224_b64url = sha512_224_b64u('any data', 'more data', 'even more data'); |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 sha512_224_file |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Reads a file given by a filename or filehandle and returns its SHA512_224 digest encoded as a binary string. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my $sha512_224_raw = sha512_224_file('filename.dat'); |
|
148
|
|
|
|
|
|
|
#or |
|
149
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
150
|
|
|
|
|
|
|
my $sha512_224_raw = sha512_224_file($filehandle); |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 sha512_224_file_hex |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Reads a file given by a filename or filehandle and returns its SHA512_224 digest encoded as a hexadecimal string. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my $sha512_224_hex = sha512_224_file_hex('filename.dat'); |
|
157
|
|
|
|
|
|
|
#or |
|
158
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
159
|
|
|
|
|
|
|
my $sha512_224_hex = sha512_224_file_hex($filehandle); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
B The filehandle must be in binary mode before you pass it to C. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 sha512_224_file_b64 |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Reads a file given by a filename or filehandle and returns its SHA512_224 digest encoded as a Base64 string, B trailing '=' padding. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
my $sha512_224_b64 = sha512_224_file_b64('filename.dat'); |
|
168
|
|
|
|
|
|
|
#or |
|
169
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
170
|
|
|
|
|
|
|
my $sha512_224_b64 = sha512_224_file_b64($filehandle); |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 sha512_224_file_b64u |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Reads a file given by a filename or filehandle and returns its SHA512_224 digest encoded as a Base64 URL-safe string (see RFC 4648 section 5). |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
my $sha512_224_b64url = sha512_224_file_b64u('filename.dat'); |
|
177
|
|
|
|
|
|
|
#or |
|
178
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
179
|
|
|
|
|
|
|
my $sha512_224_b64url = sha512_224_file_b64u($filehandle); |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 METHODS |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
The OO interface provides the same set of functions as L. |
|
184
|
|
|
|
|
|
|
Unless noted otherwise, assume C<$d> is an existing digest object created via |
|
185
|
|
|
|
|
|
|
C, for example: |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
my $d = Crypt::Digest::SHA512_224->new(); |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 new |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
my $d = Crypt::Digest::SHA512_224->new(); |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 clone |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$d->clone(); |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 reset |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
$d->reset(); |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 add |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Appends data to the message. Returns the object itself (for chaining). |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Each argument is converted to bytes using Perl's usual scalar stringification. |
|
206
|
|
|
|
|
|
|
Defined scalars, including numbers and string-overloaded objects, are |
|
207
|
|
|
|
|
|
|
accepted. C is treated as an empty string and may emit Perl's usual |
|
208
|
|
|
|
|
|
|
"uninitialized value" warning. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
$d->add('any data'); |
|
211
|
|
|
|
|
|
|
#or |
|
212
|
|
|
|
|
|
|
$d->add('any data', 'more data', 'even more data'); |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 addfile |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Reads the file content and appends it to the message. Returns the object itself (for chaining). |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
$d->addfile('filename.dat'); |
|
219
|
|
|
|
|
|
|
#or |
|
220
|
|
|
|
|
|
|
my $filehandle = ...; # existing binary-mode filehandle |
|
221
|
|
|
|
|
|
|
$d->addfile($filehandle); |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 hashsize |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
$d->hashsize; |
|
226
|
|
|
|
|
|
|
#or |
|
227
|
|
|
|
|
|
|
Crypt::Digest::SHA512_224->hashsize(); |
|
228
|
|
|
|
|
|
|
#or |
|
229
|
|
|
|
|
|
|
Crypt::Digest::SHA512_224::hashsize(); |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head2 digest |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Returns the binary digest (raw bytes). |
|
234
|
|
|
|
|
|
|
The first call finalizes the digest object. Any later C, |
|
235
|
|
|
|
|
|
|
C, C, C, C, or |
|
236
|
|
|
|
|
|
|
C call will fail until you call C. |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
my $result_raw = $d->digest(); |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head2 hexdigest |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Returns the digest encoded as a lowercase hexadecimal string. |
|
243
|
|
|
|
|
|
|
Like C, the first call finalizes the digest object. |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my $result_hex = $d->hexdigest(); |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head2 b64digest |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Returns the digest encoded as a Base64 string with trailing C<=> padding. |
|
250
|
|
|
|
|
|
|
Like C, the first call finalizes the digest object. |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
my $result_b64 = $d->b64digest(); |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 b64udigest |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Returns the digest encoded as a Base64 URL-safe string (no trailing C<=>). |
|
257
|
|
|
|
|
|
|
Like C, the first call finalizes the digest object. |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
my $result_b64url = $d->b64udigest(); |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=over |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item * L, L |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item * L |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=back |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=cut |