Package list libcryptx-perl / 31d12ad
Crypt::Digest::KeccakNNN Karel Miko 3 years ago
14 changed file(s) with 1369 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
4141 SHA3_256 => { ltc=>'sha3-256', info=>'Hash function SHA3-256 [size: 256 bits]', urls=>['https://en.wikipedia.org/wiki/SHA-3'] },
4242 SHA3_384 => { ltc=>'sha3-384', info=>'Hash function SHA3-384 [size: 384 bits]', urls=>['https://en.wikipedia.org/wiki/SHA-3'] },
4343 SHA3_512 => { ltc=>'sha3-512', info=>'Hash function SHA3-512 [size: 512 bits]', urls=>['https://en.wikipedia.org/wiki/SHA-3'] },
44 Keccak224 => { ltc=>'keccak224', info=>'Hash function Keccak-224 [size: 224 bits]', urls=>['https://keccak.team/index.html'] },
45 Keccak256 => { ltc=>'keccak256', info=>'Hash function Keccak-256 [size: 256 bits]', urls=>['https://keccak.team/index.html'] },
46 Keccak384 => { ltc=>'keccak384', info=>'Hash function Keccak-384 [size: 384 bits]', urls=>['https://keccak.team/index.html'] },
47 Keccak512 => { ltc=>'keccak512', info=>'Hash function Keccak-512 [size: 512 bits]', urls=>['https://keccak.team/index.html'] },
4448 Tiger192 => { ltc=>'tiger', info=>'Hash function Tiger-192 [size: 192 bits]', urls=>['https://en.wikipedia.org/wiki/Tiger_(cryptography)'] },
4549 Whirlpool => { ltc=>'whirlpool', info=>'Hash function Whirlpool [size: 512 bits]', urls=>['https://en.wikipedia.org/wiki/Whirlpool_(cryptography)'] },
4650 BLAKE2b_160 => { ltc=>'blake2b-160', info=>'Hash function BLAKE2b [size: 160 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] },
0 package Crypt::Digest::Keccak224;
1
2 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
3
4 use strict;
5 use warnings;
6 our $VERSION = '0.058_001';
7
8 use base qw(Crypt::Digest Exporter);
9 our %EXPORT_TAGS = ( all => [qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u )] );
10 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
11 our @EXPORT = qw();
12
13 use Carp;
14 $Carp::Internal{(__PACKAGE__)}++;
15 use Crypt::Digest;
16
17 sub hashsize { Crypt::Digest::hashsize('Keccak224') }
18 sub keccak224 { Crypt::Digest::digest_data('Keccak224', @_) }
19 sub keccak224_hex { Crypt::Digest::digest_data_hex('Keccak224', @_) }
20 sub keccak224_b64 { Crypt::Digest::digest_data_b64('Keccak224', @_) }
21 sub keccak224_b64u { Crypt::Digest::digest_data_b64u('Keccak224', @_) }
22 sub keccak224_file { Crypt::Digest::digest_file('Keccak224', @_) }
23 sub keccak224_file_hex { Crypt::Digest::digest_file_hex('Keccak224', @_) }
24 sub keccak224_file_b64 { Crypt::Digest::digest_file_b64('Keccak224', @_) }
25 sub keccak224_file_b64u { Crypt::Digest::digest_file_b64u('Keccak224', @_) }
26
27 1;
28
29 =pod
30
31 =head1 NAME
32
33 Crypt::Digest::Keccak224 - Hash function Keccak-224 [size: 224 bits]
34
35 =head1 SYNOPSIS
36
37 ### Functional interface:
38 use Crypt::Digest::Keccak224 qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u
39 keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u );
40
41 # calculate digest from string/buffer
42 $keccak224_raw = keccak224('data string');
43 $keccak224_hex = keccak224_hex('data string');
44 $keccak224_b64 = keccak224_b64('data string');
45 $keccak224_b64u = keccak224_b64u('data string');
46 # calculate digest from file
47 $keccak224_raw = keccak224_file('filename.dat');
48 $keccak224_hex = keccak224_file_hex('filename.dat');
49 $keccak224_b64 = keccak224_file_b64('filename.dat');
50 $keccak224_b64u = keccak224_file_b64u('filename.dat');
51 # calculate digest from filehandle
52 $keccak224_raw = keccak224_file(*FILEHANDLE);
53 $keccak224_hex = keccak224_file_hex(*FILEHANDLE);
54 $keccak224_b64 = keccak224_file_b64(*FILEHANDLE);
55 $keccak224_b64u = keccak224_file_b64u(*FILEHANDLE);
56
57 ### OO interface:
58 use Crypt::Digest::Keccak224;
59
60 $d = Crypt::Digest::Keccak224->new;
61 $d->add('any data');
62 $d->addfile('filename.dat');
63 $d->addfile(*FILEHANDLE);
64 $result_raw = $d->digest; # raw bytes
65 $result_hex = $d->hexdigest; # hexadecimal form
66 $result_b64 = $d->b64digest; # Base64 form
67 $result_b64u = $d->b64udigest; # Base64 URL Safe form
68
69 =head1 DESCRIPTION
70
71 Provides an interface to the Keccak224 digest algorithm.
72
73 =head1 EXPORT
74
75 Nothing is exported by default.
76
77 You can export selected functions:
78
79 use Crypt::Digest::Keccak224 qw(keccak224 keccak224_hex keccak224_b64 keccak224_b64u
80 keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u);
81
82 Or all of them at once:
83
84 use Crypt::Digest::Keccak224 ':all';
85
86 =head1 FUNCTIONS
87
88 =head2 keccak224
89
90 Logically joins all arguments into a single string, and returns its Keccak224 digest encoded as a binary string.
91
92 $keccak224_raw = keccak224('data string');
93 #or
94 $keccak224_raw = keccak224('any data', 'more data', 'even more data');
95
96 =head2 keccak224_hex
97
98 Logically joins all arguments into a single string, and returns its Keccak224 digest encoded as a hexadecimal string.
99
100 $keccak224_hex = keccak224_hex('data string');
101 #or
102 $keccak224_hex = keccak224_hex('any data', 'more data', 'even more data');
103
104 =head2 keccak224_b64
105
106 Logically joins all arguments into a single string, and returns its Keccak224 digest encoded as a Base64 string, B<with> trailing '=' padding.
107
108 $keccak224_b64 = keccak224_b64('data string');
109 #or
110 $keccak224_b64 = keccak224_b64('any data', 'more data', 'even more data');
111
112 =head2 keccak224_b64u
113
114 Logically joins all arguments into a single string, and returns its Keccak224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
115
116 $keccak224_b64url = keccak224_b64u('data string');
117 #or
118 $keccak224_b64url = keccak224_b64u('any data', 'more data', 'even more data');
119
120 =head2 keccak224_file
121
122 Reads file (defined by filename or filehandle) content, and returns its Keccak224 digest encoded as a binary string.
123
124 $keccak224_raw = keccak224_file('filename.dat');
125 #or
126 $keccak224_raw = keccak224_file(*FILEHANDLE);
127
128 =head2 keccak224_file_hex
129
130 Reads file (defined by filename or filehandle) content, and returns its Keccak224 digest encoded as a hexadecimal string.
131
132 $keccak224_hex = keccak224_file_hex('filename.dat');
133 #or
134 $keccak224_hex = keccak224_file_hex(*FILEHANDLE);
135
136 B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method.
137
138 =head2 keccak224_file_b64
139
140 Reads file (defined by filename or filehandle) content, and returns its Keccak224 digest encoded as a Base64 string, B<with> trailing '=' padding.
141
142 $keccak224_b64 = keccak224_file_b64('filename.dat');
143 #or
144 $keccak224_b64 = keccak224_file_b64(*FILEHANDLE);
145
146 =head2 keccak224_file_b64u
147
148 Reads file (defined by filename or filehandle) content, and returns its Keccak224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
149
150 $keccak224_b64url = keccak224_file_b64u('filename.dat');
151 #or
152 $keccak224_b64url = keccak224_file_b64u(*FILEHANDLE);
153
154 =head1 METHODS
155
156 The OO interface provides the same set of functions as L<Crypt::Digest>.
157
158 =head2 new
159
160 $d = Crypt::Digest::Keccak224->new();
161
162 =head2 clone
163
164 $d->clone();
165
166 =head2 reset
167
168 $d->reset();
169
170 =head2 add
171
172 $d->add('any data');
173 #or
174 $d->add('any data', 'more data', 'even more data');
175
176 =head2 addfile
177
178 $d->addfile('filename.dat');
179 #or
180 $d->addfile(*FILEHANDLE);
181
182 =head2 add_bits
183
184 $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010");
185 #or
186 $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16);
187
188 =head2 hashsize
189
190 $d->hashsize;
191 #or
192 Crypt::Digest::Keccak224->hashsize();
193 #or
194 Crypt::Digest::Keccak224::hashsize();
195
196 =head2 digest
197
198 $result_raw = $d->digest();
199
200 =head2 hexdigest
201
202 $result_hex = $d->hexdigest();
203
204 =head2 b64digest
205
206 $result_b64 = $d->b64digest();
207
208 =head2 b64udigest
209
210 $result_b64url = $d->b64udigest();
211
212 =head1 SEE ALSO
213
214 =over
215
216 =item * L<CryptX|CryptX>, L<Crypt::Digest>
217
218 =item * L<https://keccak.team/index.html>
219
220 =back
221
222 =cut
0 package Crypt::Digest::Keccak256;
1
2 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
3
4 use strict;
5 use warnings;
6 our $VERSION = '0.058_001';
7
8 use base qw(Crypt::Digest Exporter);
9 our %EXPORT_TAGS = ( all => [qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u )] );
10 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
11 our @EXPORT = qw();
12
13 use Carp;
14 $Carp::Internal{(__PACKAGE__)}++;
15 use Crypt::Digest;
16
17 sub hashsize { Crypt::Digest::hashsize('Keccak256') }
18 sub keccak256 { Crypt::Digest::digest_data('Keccak256', @_) }
19 sub keccak256_hex { Crypt::Digest::digest_data_hex('Keccak256', @_) }
20 sub keccak256_b64 { Crypt::Digest::digest_data_b64('Keccak256', @_) }
21 sub keccak256_b64u { Crypt::Digest::digest_data_b64u('Keccak256', @_) }
22 sub keccak256_file { Crypt::Digest::digest_file('Keccak256', @_) }
23 sub keccak256_file_hex { Crypt::Digest::digest_file_hex('Keccak256', @_) }
24 sub keccak256_file_b64 { Crypt::Digest::digest_file_b64('Keccak256', @_) }
25 sub keccak256_file_b64u { Crypt::Digest::digest_file_b64u('Keccak256', @_) }
26
27 1;
28
29 =pod
30
31 =head1 NAME
32
33 Crypt::Digest::Keccak256 - Hash function Keccak-256 [size: 256 bits]
34
35 =head1 SYNOPSIS
36
37 ### Functional interface:
38 use Crypt::Digest::Keccak256 qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u
39 keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u );
40
41 # calculate digest from string/buffer
42 $keccak256_raw = keccak256('data string');
43 $keccak256_hex = keccak256_hex('data string');
44 $keccak256_b64 = keccak256_b64('data string');
45 $keccak256_b64u = keccak256_b64u('data string');
46 # calculate digest from file
47 $keccak256_raw = keccak256_file('filename.dat');
48 $keccak256_hex = keccak256_file_hex('filename.dat');
49 $keccak256_b64 = keccak256_file_b64('filename.dat');
50 $keccak256_b64u = keccak256_file_b64u('filename.dat');
51 # calculate digest from filehandle
52 $keccak256_raw = keccak256_file(*FILEHANDLE);
53 $keccak256_hex = keccak256_file_hex(*FILEHANDLE);
54 $keccak256_b64 = keccak256_file_b64(*FILEHANDLE);
55 $keccak256_b64u = keccak256_file_b64u(*FILEHANDLE);
56
57 ### OO interface:
58 use Crypt::Digest::Keccak256;
59
60 $d = Crypt::Digest::Keccak256->new;
61 $d->add('any data');
62 $d->addfile('filename.dat');
63 $d->addfile(*FILEHANDLE);
64 $result_raw = $d->digest; # raw bytes
65 $result_hex = $d->hexdigest; # hexadecimal form
66 $result_b64 = $d->b64digest; # Base64 form
67 $result_b64u = $d->b64udigest; # Base64 URL Safe form
68
69 =head1 DESCRIPTION
70
71 Provides an interface to the Keccak256 digest algorithm.
72
73 =head1 EXPORT
74
75 Nothing is exported by default.
76
77 You can export selected functions:
78
79 use Crypt::Digest::Keccak256 qw(keccak256 keccak256_hex keccak256_b64 keccak256_b64u
80 keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u);
81
82 Or all of them at once:
83
84 use Crypt::Digest::Keccak256 ':all';
85
86 =head1 FUNCTIONS
87
88 =head2 keccak256
89
90 Logically joins all arguments into a single string, and returns its Keccak256 digest encoded as a binary string.
91
92 $keccak256_raw = keccak256('data string');
93 #or
94 $keccak256_raw = keccak256('any data', 'more data', 'even more data');
95
96 =head2 keccak256_hex
97
98 Logically joins all arguments into a single string, and returns its Keccak256 digest encoded as a hexadecimal string.
99
100 $keccak256_hex = keccak256_hex('data string');
101 #or
102 $keccak256_hex = keccak256_hex('any data', 'more data', 'even more data');
103
104 =head2 keccak256_b64
105
106 Logically joins all arguments into a single string, and returns its Keccak256 digest encoded as a Base64 string, B<with> trailing '=' padding.
107
108 $keccak256_b64 = keccak256_b64('data string');
109 #or
110 $keccak256_b64 = keccak256_b64('any data', 'more data', 'even more data');
111
112 =head2 keccak256_b64u
113
114 Logically joins all arguments into a single string, and returns its Keccak256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
115
116 $keccak256_b64url = keccak256_b64u('data string');
117 #or
118 $keccak256_b64url = keccak256_b64u('any data', 'more data', 'even more data');
119
120 =head2 keccak256_file
121
122 Reads file (defined by filename or filehandle) content, and returns its Keccak256 digest encoded as a binary string.
123
124 $keccak256_raw = keccak256_file('filename.dat');
125 #or
126 $keccak256_raw = keccak256_file(*FILEHANDLE);
127
128 =head2 keccak256_file_hex
129
130 Reads file (defined by filename or filehandle) content, and returns its Keccak256 digest encoded as a hexadecimal string.
131
132 $keccak256_hex = keccak256_file_hex('filename.dat');
133 #or
134 $keccak256_hex = keccak256_file_hex(*FILEHANDLE);
135
136 B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method.
137
138 =head2 keccak256_file_b64
139
140 Reads file (defined by filename or filehandle) content, and returns its Keccak256 digest encoded as a Base64 string, B<with> trailing '=' padding.
141
142 $keccak256_b64 = keccak256_file_b64('filename.dat');
143 #or
144 $keccak256_b64 = keccak256_file_b64(*FILEHANDLE);
145
146 =head2 keccak256_file_b64u
147
148 Reads file (defined by filename or filehandle) content, and returns its Keccak256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
149
150 $keccak256_b64url = keccak256_file_b64u('filename.dat');
151 #or
152 $keccak256_b64url = keccak256_file_b64u(*FILEHANDLE);
153
154 =head1 METHODS
155
156 The OO interface provides the same set of functions as L<Crypt::Digest>.
157
158 =head2 new
159
160 $d = Crypt::Digest::Keccak256->new();
161
162 =head2 clone
163
164 $d->clone();
165
166 =head2 reset
167
168 $d->reset();
169
170 =head2 add
171
172 $d->add('any data');
173 #or
174 $d->add('any data', 'more data', 'even more data');
175
176 =head2 addfile
177
178 $d->addfile('filename.dat');
179 #or
180 $d->addfile(*FILEHANDLE);
181
182 =head2 add_bits
183
184 $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010");
185 #or
186 $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16);
187
188 =head2 hashsize
189
190 $d->hashsize;
191 #or
192 Crypt::Digest::Keccak256->hashsize();
193 #or
194 Crypt::Digest::Keccak256::hashsize();
195
196 =head2 digest
197
198 $result_raw = $d->digest();
199
200 =head2 hexdigest
201
202 $result_hex = $d->hexdigest();
203
204 =head2 b64digest
205
206 $result_b64 = $d->b64digest();
207
208 =head2 b64udigest
209
210 $result_b64url = $d->b64udigest();
211
212 =head1 SEE ALSO
213
214 =over
215
216 =item * L<CryptX|CryptX>, L<Crypt::Digest>
217
218 =item * L<https://keccak.team/index.html>
219
220 =back
221
222 =cut
0 package Crypt::Digest::Keccak384;
1
2 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
3
4 use strict;
5 use warnings;
6 our $VERSION = '0.058_001';
7
8 use base qw(Crypt::Digest Exporter);
9 our %EXPORT_TAGS = ( all => [qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u )] );
10 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
11 our @EXPORT = qw();
12
13 use Carp;
14 $Carp::Internal{(__PACKAGE__)}++;
15 use Crypt::Digest;
16
17 sub hashsize { Crypt::Digest::hashsize('Keccak384') }
18 sub keccak384 { Crypt::Digest::digest_data('Keccak384', @_) }
19 sub keccak384_hex { Crypt::Digest::digest_data_hex('Keccak384', @_) }
20 sub keccak384_b64 { Crypt::Digest::digest_data_b64('Keccak384', @_) }
21 sub keccak384_b64u { Crypt::Digest::digest_data_b64u('Keccak384', @_) }
22 sub keccak384_file { Crypt::Digest::digest_file('Keccak384', @_) }
23 sub keccak384_file_hex { Crypt::Digest::digest_file_hex('Keccak384', @_) }
24 sub keccak384_file_b64 { Crypt::Digest::digest_file_b64('Keccak384', @_) }
25 sub keccak384_file_b64u { Crypt::Digest::digest_file_b64u('Keccak384', @_) }
26
27 1;
28
29 =pod
30
31 =head1 NAME
32
33 Crypt::Digest::Keccak384 - Hash function Keccak-384 [size: 384 bits]
34
35 =head1 SYNOPSIS
36
37 ### Functional interface:
38 use Crypt::Digest::Keccak384 qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u
39 keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u );
40
41 # calculate digest from string/buffer
42 $keccak384_raw = keccak384('data string');
43 $keccak384_hex = keccak384_hex('data string');
44 $keccak384_b64 = keccak384_b64('data string');
45 $keccak384_b64u = keccak384_b64u('data string');
46 # calculate digest from file
47 $keccak384_raw = keccak384_file('filename.dat');
48 $keccak384_hex = keccak384_file_hex('filename.dat');
49 $keccak384_b64 = keccak384_file_b64('filename.dat');
50 $keccak384_b64u = keccak384_file_b64u('filename.dat');
51 # calculate digest from filehandle
52 $keccak384_raw = keccak384_file(*FILEHANDLE);
53 $keccak384_hex = keccak384_file_hex(*FILEHANDLE);
54 $keccak384_b64 = keccak384_file_b64(*FILEHANDLE);
55 $keccak384_b64u = keccak384_file_b64u(*FILEHANDLE);
56
57 ### OO interface:
58 use Crypt::Digest::Keccak384;
59
60 $d = Crypt::Digest::Keccak384->new;
61 $d->add('any data');
62 $d->addfile('filename.dat');
63 $d->addfile(*FILEHANDLE);
64 $result_raw = $d->digest; # raw bytes
65 $result_hex = $d->hexdigest; # hexadecimal form
66 $result_b64 = $d->b64digest; # Base64 form
67 $result_b64u = $d->b64udigest; # Base64 URL Safe form
68
69 =head1 DESCRIPTION
70
71 Provides an interface to the Keccak384 digest algorithm.
72
73 =head1 EXPORT
74
75 Nothing is exported by default.
76
77 You can export selected functions:
78
79 use Crypt::Digest::Keccak384 qw(keccak384 keccak384_hex keccak384_b64 keccak384_b64u
80 keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u);
81
82 Or all of them at once:
83
84 use Crypt::Digest::Keccak384 ':all';
85
86 =head1 FUNCTIONS
87
88 =head2 keccak384
89
90 Logically joins all arguments into a single string, and returns its Keccak384 digest encoded as a binary string.
91
92 $keccak384_raw = keccak384('data string');
93 #or
94 $keccak384_raw = keccak384('any data', 'more data', 'even more data');
95
96 =head2 keccak384_hex
97
98 Logically joins all arguments into a single string, and returns its Keccak384 digest encoded as a hexadecimal string.
99
100 $keccak384_hex = keccak384_hex('data string');
101 #or
102 $keccak384_hex = keccak384_hex('any data', 'more data', 'even more data');
103
104 =head2 keccak384_b64
105
106 Logically joins all arguments into a single string, and returns its Keccak384 digest encoded as a Base64 string, B<with> trailing '=' padding.
107
108 $keccak384_b64 = keccak384_b64('data string');
109 #or
110 $keccak384_b64 = keccak384_b64('any data', 'more data', 'even more data');
111
112 =head2 keccak384_b64u
113
114 Logically joins all arguments into a single string, and returns its Keccak384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
115
116 $keccak384_b64url = keccak384_b64u('data string');
117 #or
118 $keccak384_b64url = keccak384_b64u('any data', 'more data', 'even more data');
119
120 =head2 keccak384_file
121
122 Reads file (defined by filename or filehandle) content, and returns its Keccak384 digest encoded as a binary string.
123
124 $keccak384_raw = keccak384_file('filename.dat');
125 #or
126 $keccak384_raw = keccak384_file(*FILEHANDLE);
127
128 =head2 keccak384_file_hex
129
130 Reads file (defined by filename or filehandle) content, and returns its Keccak384 digest encoded as a hexadecimal string.
131
132 $keccak384_hex = keccak384_file_hex('filename.dat');
133 #or
134 $keccak384_hex = keccak384_file_hex(*FILEHANDLE);
135
136 B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method.
137
138 =head2 keccak384_file_b64
139
140 Reads file (defined by filename or filehandle) content, and returns its Keccak384 digest encoded as a Base64 string, B<with> trailing '=' padding.
141
142 $keccak384_b64 = keccak384_file_b64('filename.dat');
143 #or
144 $keccak384_b64 = keccak384_file_b64(*FILEHANDLE);
145
146 =head2 keccak384_file_b64u
147
148 Reads file (defined by filename or filehandle) content, and returns its Keccak384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
149
150 $keccak384_b64url = keccak384_file_b64u('filename.dat');
151 #or
152 $keccak384_b64url = keccak384_file_b64u(*FILEHANDLE);
153
154 =head1 METHODS
155
156 The OO interface provides the same set of functions as L<Crypt::Digest>.
157
158 =head2 new
159
160 $d = Crypt::Digest::Keccak384->new();
161
162 =head2 clone
163
164 $d->clone();
165
166 =head2 reset
167
168 $d->reset();
169
170 =head2 add
171
172 $d->add('any data');
173 #or
174 $d->add('any data', 'more data', 'even more data');
175
176 =head2 addfile
177
178 $d->addfile('filename.dat');
179 #or
180 $d->addfile(*FILEHANDLE);
181
182 =head2 add_bits
183
184 $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010");
185 #or
186 $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16);
187
188 =head2 hashsize
189
190 $d->hashsize;
191 #or
192 Crypt::Digest::Keccak384->hashsize();
193 #or
194 Crypt::Digest::Keccak384::hashsize();
195
196 =head2 digest
197
198 $result_raw = $d->digest();
199
200 =head2 hexdigest
201
202 $result_hex = $d->hexdigest();
203
204 =head2 b64digest
205
206 $result_b64 = $d->b64digest();
207
208 =head2 b64udigest
209
210 $result_b64url = $d->b64udigest();
211
212 =head1 SEE ALSO
213
214 =over
215
216 =item * L<CryptX|CryptX>, L<Crypt::Digest>
217
218 =item * L<https://keccak.team/index.html>
219
220 =back
221
222 =cut
0 package Crypt::Digest::Keccak512;
1
2 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
3
4 use strict;
5 use warnings;
6 our $VERSION = '0.058_001';
7
8 use base qw(Crypt::Digest Exporter);
9 our %EXPORT_TAGS = ( all => [qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u )] );
10 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
11 our @EXPORT = qw();
12
13 use Carp;
14 $Carp::Internal{(__PACKAGE__)}++;
15 use Crypt::Digest;
16
17 sub hashsize { Crypt::Digest::hashsize('Keccak512') }
18 sub keccak512 { Crypt::Digest::digest_data('Keccak512', @_) }
19 sub keccak512_hex { Crypt::Digest::digest_data_hex('Keccak512', @_) }
20 sub keccak512_b64 { Crypt::Digest::digest_data_b64('Keccak512', @_) }
21 sub keccak512_b64u { Crypt::Digest::digest_data_b64u('Keccak512', @_) }
22 sub keccak512_file { Crypt::Digest::digest_file('Keccak512', @_) }
23 sub keccak512_file_hex { Crypt::Digest::digest_file_hex('Keccak512', @_) }
24 sub keccak512_file_b64 { Crypt::Digest::digest_file_b64('Keccak512', @_) }
25 sub keccak512_file_b64u { Crypt::Digest::digest_file_b64u('Keccak512', @_) }
26
27 1;
28
29 =pod
30
31 =head1 NAME
32
33 Crypt::Digest::Keccak512 - Hash function Keccak-512 [size: 512 bits]
34
35 =head1 SYNOPSIS
36
37 ### Functional interface:
38 use Crypt::Digest::Keccak512 qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u
39 keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u );
40
41 # calculate digest from string/buffer
42 $keccak512_raw = keccak512('data string');
43 $keccak512_hex = keccak512_hex('data string');
44 $keccak512_b64 = keccak512_b64('data string');
45 $keccak512_b64u = keccak512_b64u('data string');
46 # calculate digest from file
47 $keccak512_raw = keccak512_file('filename.dat');
48 $keccak512_hex = keccak512_file_hex('filename.dat');
49 $keccak512_b64 = keccak512_file_b64('filename.dat');
50 $keccak512_b64u = keccak512_file_b64u('filename.dat');
51 # calculate digest from filehandle
52 $keccak512_raw = keccak512_file(*FILEHANDLE);
53 $keccak512_hex = keccak512_file_hex(*FILEHANDLE);
54 $keccak512_b64 = keccak512_file_b64(*FILEHANDLE);
55 $keccak512_b64u = keccak512_file_b64u(*FILEHANDLE);
56
57 ### OO interface:
58 use Crypt::Digest::Keccak512;
59
60 $d = Crypt::Digest::Keccak512->new;
61 $d->add('any data');
62 $d->addfile('filename.dat');
63 $d->addfile(*FILEHANDLE);
64 $result_raw = $d->digest; # raw bytes
65 $result_hex = $d->hexdigest; # hexadecimal form
66 $result_b64 = $d->b64digest; # Base64 form
67 $result_b64u = $d->b64udigest; # Base64 URL Safe form
68
69 =head1 DESCRIPTION
70
71 Provides an interface to the Keccak512 digest algorithm.
72
73 =head1 EXPORT
74
75 Nothing is exported by default.
76
77 You can export selected functions:
78
79 use Crypt::Digest::Keccak512 qw(keccak512 keccak512_hex keccak512_b64 keccak512_b64u
80 keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u);
81
82 Or all of them at once:
83
84 use Crypt::Digest::Keccak512 ':all';
85
86 =head1 FUNCTIONS
87
88 =head2 keccak512
89
90 Logically joins all arguments into a single string, and returns its Keccak512 digest encoded as a binary string.
91
92 $keccak512_raw = keccak512('data string');
93 #or
94 $keccak512_raw = keccak512('any data', 'more data', 'even more data');
95
96 =head2 keccak512_hex
97
98 Logically joins all arguments into a single string, and returns its Keccak512 digest encoded as a hexadecimal string.
99
100 $keccak512_hex = keccak512_hex('data string');
101 #or
102 $keccak512_hex = keccak512_hex('any data', 'more data', 'even more data');
103
104 =head2 keccak512_b64
105
106 Logically joins all arguments into a single string, and returns its Keccak512 digest encoded as a Base64 string, B<with> trailing '=' padding.
107
108 $keccak512_b64 = keccak512_b64('data string');
109 #or
110 $keccak512_b64 = keccak512_b64('any data', 'more data', 'even more data');
111
112 =head2 keccak512_b64u
113
114 Logically joins all arguments into a single string, and returns its Keccak512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
115
116 $keccak512_b64url = keccak512_b64u('data string');
117 #or
118 $keccak512_b64url = keccak512_b64u('any data', 'more data', 'even more data');
119
120 =head2 keccak512_file
121
122 Reads file (defined by filename or filehandle) content, and returns its Keccak512 digest encoded as a binary string.
123
124 $keccak512_raw = keccak512_file('filename.dat');
125 #or
126 $keccak512_raw = keccak512_file(*FILEHANDLE);
127
128 =head2 keccak512_file_hex
129
130 Reads file (defined by filename or filehandle) content, and returns its Keccak512 digest encoded as a hexadecimal string.
131
132 $keccak512_hex = keccak512_file_hex('filename.dat');
133 #or
134 $keccak512_hex = keccak512_file_hex(*FILEHANDLE);
135
136 B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method.
137
138 =head2 keccak512_file_b64
139
140 Reads file (defined by filename or filehandle) content, and returns its Keccak512 digest encoded as a Base64 string, B<with> trailing '=' padding.
141
142 $keccak512_b64 = keccak512_file_b64('filename.dat');
143 #or
144 $keccak512_b64 = keccak512_file_b64(*FILEHANDLE);
145
146 =head2 keccak512_file_b64u
147
148 Reads file (defined by filename or filehandle) content, and returns its Keccak512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5).
149
150 $keccak512_b64url = keccak512_file_b64u('filename.dat');
151 #or
152 $keccak512_b64url = keccak512_file_b64u(*FILEHANDLE);
153
154 =head1 METHODS
155
156 The OO interface provides the same set of functions as L<Crypt::Digest>.
157
158 =head2 new
159
160 $d = Crypt::Digest::Keccak512->new();
161
162 =head2 clone
163
164 $d->clone();
165
166 =head2 reset
167
168 $d->reset();
169
170 =head2 add
171
172 $d->add('any data');
173 #or
174 $d->add('any data', 'more data', 'even more data');
175
176 =head2 addfile
177
178 $d->addfile('filename.dat');
179 #or
180 $d->addfile(*FILEHANDLE);
181
182 =head2 add_bits
183
184 $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010");
185 #or
186 $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16);
187
188 =head2 hashsize
189
190 $d->hashsize;
191 #or
192 Crypt::Digest::Keccak512->hashsize();
193 #or
194 Crypt::Digest::Keccak512::hashsize();
195
196 =head2 digest
197
198 $result_raw = $d->digest();
199
200 =head2 hexdigest
201
202 $result_hex = $d->hexdigest();
203
204 =head2 b64digest
205
206 $result_b64 = $d->b64digest();
207
208 =head2 b64udigest
209
210 $result_b64url = $d->b64udigest();
211
212 =head1 SEE ALSO
213
214 =over
215
216 =item * L<CryptX|CryptX>, L<Crypt::Digest>
217
218 =item * L<https://keccak.team/index.html>
219
220 =back
221
222 =cut
9595 L<Crypt::Digest::CHAES>, L<Crypt::Digest::MD2>, L<Crypt::Digest::MD4>, L<Crypt::Digest::MD5>, L<Crypt::Digest::RIPEMD128>, L<Crypt::Digest::RIPEMD160>,
9696 L<Crypt::Digest::RIPEMD256>, L<Crypt::Digest::RIPEMD320>, L<Crypt::Digest::SHA1>, L<Crypt::Digest::SHA224>, L<Crypt::Digest::SHA256>, L<Crypt::Digest::SHA384>,
9797 L<Crypt::Digest::SHA512>, L<Crypt::Digest::SHA512_224>, L<Crypt::Digest::SHA512_256>, L<Crypt::Digest::Tiger192>, L<Crypt::Digest::Whirlpool>,
98 L<Crypt::Digest::Keccak224>, L<Crypt::Digest::Keccak256>, L<Crypt::Digest::Keccak384>, L<Crypt::Digest::Keccak512>,
9899 L<Crypt::Digest::SHA3_224>, L<Crypt::Digest::SHA3_256>, L<Crypt::Digest::SHA3_384>, L<Crypt::Digest::SHA3_512>, L<Crypt::Digest::SHAKE>
99100
100101 =item * Checksums
6767 use Crypt::Digest::SHA3_256;
6868 use Crypt::Digest::SHA3_384;
6969 use Crypt::Digest::SHA3_512;
70 use Crypt::Digest::Keccak224;
71 use Crypt::Digest::Keccak256;
72 use Crypt::Digest::Keccak384;
73 use Crypt::Digest::Keccak512;
7074 use Crypt::Digest::SHA512;
7175 use Crypt::Digest::SHA512_224;
7276 use Crypt::Digest::SHA512_256;
55 plan skip_all => "set TEST_POD to enable this test (developer only!)" unless $ENV{TEST_POD};
66 plan skip_all => "File::Find not installed" unless eval { require File::Find };
77 plan skip_all => "Test::Pod not installed" unless eval { require Test::Pod };
8 plan tests => 103;
8 plan tests => 107;
99
1010 my @files;
1111 File::Find::find({ wanted=>sub { push @files, $_ if /\.pm$/ }, no_chdir=>1 }, 'lib');
1616 params paramshash irand perl endian zbase bumac bmac budigest bdigest md de
1717 blakes_ blakeb_
1818 XOR'ing XOR'ed
19 keccak
1920 )]
2021 },
2122 );
2223
23 plan tests => 103;
24 plan tests => 107;
2425
2526 my @files;
2627 File::Find::find({ wanted=>sub { push @files, $_ if /\.pm$/ }, no_chdir=>1 }, 'lib');
55 plan skip_all => "set TEST_POD to enable this test (developer only!)" unless $ENV{TEST_POD};
66 plan skip_all => "Pod::Coverage not installed" unless eval { require Pod::Coverage };
77 plan skip_all => "File::Find not installed" unless eval { require File::Find };
8 plan tests => 103;
8 plan tests => 107;
99
1010 my @files;
1111 File::Find::find({ wanted=>sub { push @files, $_ if /\.pm$/ }, no_chdir=>1 }, 'lib');
0 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
1
2 use strict;
3 use warnings;
4
5 use Test::More tests => 8*3 + 9*4 + 10 + 6;
6
7 use Crypt::Digest qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u );
8 use Crypt::Digest::Keccak224 qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u );
9
10 is( Crypt::Digest::hashsize('Keccak224'), 28, 'hashsize/1');
11 is( Crypt::Digest->hashsize('Keccak224'), 28, 'hashsize/2');
12 is( Crypt::Digest::Keccak224::hashsize, 28, 'hashsize/3');
13 is( Crypt::Digest::Keccak224->hashsize, 28, 'hashsize/4');
14 is( Crypt::Digest->new('Keccak224')->hashsize, 28, 'hashsize/5');
15 is( Crypt::Digest::Keccak224->new->hashsize, 28, 'hashsize/6');
16
17 is( keccak224("A","A","A"), pack("H*","92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252"), 'keccak224 (raw/tripple_A)');
18 is( keccak224_hex("A","A","A"), "92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252", 'keccak224 (hex/tripple_A)');
19 is( keccak224_b64("A","A","A"), "krnSolIi0qA2xTvU3SRrQHPRAOCuIKxyQPWyUg==", 'keccak224 (base64/tripple_A)');
20 is( keccak224_b64u("A","A","A"), "krnSolIi0qA2xTvU3SRrQHPRAOCuIKxyQPWyUg", 'keccak224 (base64url/tripple_A)');
21 is( digest_data('Keccak224', "A","A","A"), pack("H*","92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252"), 'keccak224 (digest_data_raw/tripple_A)');
22 is( digest_data_hex('Keccak224', "A","A","A"), "92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252", 'keccak224 (digest_data_hex/tripple_A)');
23 is( digest_data_b64('Keccak224', "A","A","A"), "krnSolIi0qA2xTvU3SRrQHPRAOCuIKxyQPWyUg==", 'keccak224 (digest_data_b64/tripple_A)');
24 is( digest_data_b64u('Keccak224', "A","A","A"), "krnSolIi0qA2xTvU3SRrQHPRAOCuIKxyQPWyUg", 'keccak224 (digest_data_b64u/tripple_A)');
25 is( Crypt::Digest::Keccak224->new->add("A","A","A")->hexdigest, "92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252", 'keccak224 (OO/tripple_A)');
26 is( Crypt::Digest::Keccak224->new->add("A")->add("A")->add("A")->hexdigest, "92b9d2a25222d2a036c53bd4dd246b4073d100e0ae20ac7240f5b252", 'keccak224 (OO3/tripple_A)');
27
28
29 is( keccak224(""), pack("H*","f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd"), 'keccak224 (raw/1)');
30 is( keccak224_hex(""), "f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd", 'keccak224 (hex/1)');
31 is( keccak224_b64(""), "9xg3UCuo4Qg3vdjTZa24VZGJVgL8VStItzkKvQ==", 'keccak224 (base64/1)');
32 is( digest_data('Keccak224', ""), pack("H*","f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd"), 'keccak224 (digest_data_raw/1)');
33 is( digest_data_hex('Keccak224', ""), "f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd", 'keccak224 (digest_data_hex/1)');
34 is( digest_data_b64('Keccak224', ""), "9xg3UCuo4Qg3vdjTZa24VZGJVgL8VStItzkKvQ==", 'keccak224 (digest_data_b64/1)');
35 is( digest_data_b64u('Keccak224', ""), "9xg3UCuo4Qg3vdjTZa24VZGJVgL8VStItzkKvQ", 'keccak224 (digest_data_b64u/1)');
36 is( Crypt::Digest::Keccak224->new->add("")->hexdigest, "f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd", 'keccak224 (OO/1)');
37
38 is( keccak224("123"), pack("H*","5c52615361ce4c5469f9d8c90113c7a543a4bf43490782d291cb32d8"), 'keccak224 (raw/2)');
39 is( keccak224_hex("123"), "5c52615361ce4c5469f9d8c90113c7a543a4bf43490782d291cb32d8", 'keccak224 (hex/2)');
40 is( keccak224_b64("123"), "XFJhU2HOTFRp+djJARPHpUOkv0NJB4LSkcsy2A==", 'keccak224 (base64/2)');
41 is( digest_data('Keccak224', "123"), pack("H*","5c52615361ce4c5469f9d8c90113c7a543a4bf43490782d291cb32d8"), 'keccak224 (digest_data_raw/2)');
42 is( digest_data_hex('Keccak224', "123"), "5c52615361ce4c5469f9d8c90113c7a543a4bf43490782d291cb32d8", 'keccak224 (digest_data_hex/2)');
43 is( digest_data_b64('Keccak224', "123"), "XFJhU2HOTFRp+djJARPHpUOkv0NJB4LSkcsy2A==", 'keccak224 (digest_data_b64/2)');
44 is( digest_data_b64u('Keccak224', "123"), "XFJhU2HOTFRp-djJARPHpUOkv0NJB4LSkcsy2A", 'keccak224 (digest_data_b64u/2)');
45 is( Crypt::Digest::Keccak224->new->add("123")->hexdigest, "5c52615361ce4c5469f9d8c90113c7a543a4bf43490782d291cb32d8", 'keccak224 (OO/2)');
46
47 is( keccak224("test\0test\0test\n"), pack("H*","7cbb8e9a6026e7c8324ab2f1cba55a1aff03b7b0424b8915b0439179"), 'keccak224 (raw/3)');
48 is( keccak224_hex("test\0test\0test\n"), "7cbb8e9a6026e7c8324ab2f1cba55a1aff03b7b0424b8915b0439179", 'keccak224 (hex/3)');
49 is( keccak224_b64("test\0test\0test\n"), "fLuOmmAm58gySrLxy6VaGv8Dt7BCS4kVsEOReQ==", 'keccak224 (base64/3)');
50 is( digest_data('Keccak224', "test\0test\0test\n"), pack("H*","7cbb8e9a6026e7c8324ab2f1cba55a1aff03b7b0424b8915b0439179"), 'keccak224 (digest_data_raw/3)');
51 is( digest_data_hex('Keccak224', "test\0test\0test\n"), "7cbb8e9a6026e7c8324ab2f1cba55a1aff03b7b0424b8915b0439179", 'keccak224 (digest_data_hex/3)');
52 is( digest_data_b64('Keccak224', "test\0test\0test\n"), "fLuOmmAm58gySrLxy6VaGv8Dt7BCS4kVsEOReQ==", 'keccak224 (digest_data_b64/3)');
53 is( digest_data_b64u('Keccak224', "test\0test\0test\n"), "fLuOmmAm58gySrLxy6VaGv8Dt7BCS4kVsEOReQ", 'keccak224 (digest_data_b64u/3)');
54 is( Crypt::Digest::Keccak224->new->add("test\0test\0test\n")->hexdigest, "7cbb8e9a6026e7c8324ab2f1cba55a1aff03b7b0424b8915b0439179", 'keccak224 (OO/3)');
55
56
57 is( keccak224_file('t/data/binary-test.file'), pack("H*","8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e"), 'keccak224 (raw/file/1)');
58 is( keccak224_file_hex('t/data/binary-test.file'), "8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e", 'keccak224 (hex/file/1)');
59 is( keccak224_file_b64('t/data/binary-test.file'), "jxZR/6uQNhkxShs9fImu+8H49UEomxiJMgsajg==", 'keccak224 (base64/file/1)');
60 is( digest_file('Keccak224', 't/data/binary-test.file'), pack("H*","8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e"), 'keccak224 (digest_file_raw/file/1)');
61 is( digest_file_hex('Keccak224', 't/data/binary-test.file'), "8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e", 'keccak224 (digest_file_hex/file/1)');
62 is( digest_file_b64('Keccak224', 't/data/binary-test.file'), "jxZR/6uQNhkxShs9fImu+8H49UEomxiJMgsajg==", 'keccak224 (digest_file_b64/file/1)');
63 is( digest_file_b64u('Keccak224', 't/data/binary-test.file'), "jxZR_6uQNhkxShs9fImu-8H49UEomxiJMgsajg", 'keccak224 (digest_file_b64u/file/1)');
64 is( Crypt::Digest::Keccak224->new->addfile('t/data/binary-test.file')->hexdigest, "8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e", 'keccak224 (OO/file/1)');
65 {
66 open(my $fh, '<', 't/data/binary-test.file');
67 binmode($fh);
68 is( Crypt::Digest::Keccak224->new->addfile($fh)->hexdigest, "8f1651ffab903619314a1b3d7c89aefbc1f8f541289b1889320b1a8e", 'keccak224 (OO/filehandle/1)');
69 close($fh);
70 }
71
72 is( keccak224_file('t/data/text-CR.file'), pack("H*","28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8"), 'keccak224 (raw/file/2)');
73 is( keccak224_file_hex('t/data/text-CR.file'), "28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8", 'keccak224 (hex/file/2)');
74 is( keccak224_file_b64('t/data/text-CR.file'), "KP+KFzguH6EcN81uJUO/JX+RSq43YO93BzmHyA==", 'keccak224 (base64/file/2)');
75 is( digest_file('Keccak224', 't/data/text-CR.file'), pack("H*","28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8"), 'keccak224 (digest_file_raw/file/2)');
76 is( digest_file_hex('Keccak224', 't/data/text-CR.file'), "28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8", 'keccak224 (digest_file_hex/file/2)');
77 is( digest_file_b64('Keccak224', 't/data/text-CR.file'), "KP+KFzguH6EcN81uJUO/JX+RSq43YO93BzmHyA==", 'keccak224 (digest_file_b64/file/2)');
78 is( digest_file_b64u('Keccak224', 't/data/text-CR.file'), "KP-KFzguH6EcN81uJUO_JX-RSq43YO93BzmHyA", 'keccak224 (digest_file_b64u/file/2)');
79 is( Crypt::Digest::Keccak224->new->addfile('t/data/text-CR.file')->hexdigest, "28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8", 'keccak224 (OO/file/2)');
80 {
81 open(my $fh, '<', 't/data/text-CR.file');
82 binmode($fh);
83 is( Crypt::Digest::Keccak224->new->addfile($fh)->hexdigest, "28ff8a17382e1fa11c37cd6e2543bf257f914aae3760ef77073987c8", 'keccak224 (OO/filehandle/2)');
84 close($fh);
85 }
86
87 is( keccak224_file('t/data/text-CRLF.file'), pack("H*","26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa"), 'keccak224 (raw/file/3)');
88 is( keccak224_file_hex('t/data/text-CRLF.file'), "26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa", 'keccak224 (hex/file/3)');
89 is( keccak224_file_b64('t/data/text-CRLF.file'), "JmWQCHWUI83kTEmEdIr2th19TqXH6Bvlj7cvqg==", 'keccak224 (base64/file/3)');
90 is( digest_file('Keccak224', 't/data/text-CRLF.file'), pack("H*","26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa"), 'keccak224 (digest_file_raw/file/3)');
91 is( digest_file_hex('Keccak224', 't/data/text-CRLF.file'), "26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa", 'keccak224 (digest_file_hex/file/3)');
92 is( digest_file_b64('Keccak224', 't/data/text-CRLF.file'), "JmWQCHWUI83kTEmEdIr2th19TqXH6Bvlj7cvqg==", 'keccak224 (digest_file_b64/file/3)');
93 is( digest_file_b64u('Keccak224', 't/data/text-CRLF.file'), "JmWQCHWUI83kTEmEdIr2th19TqXH6Bvlj7cvqg", 'keccak224 (digest_file_b64u/file/3)');
94 is( Crypt::Digest::Keccak224->new->addfile('t/data/text-CRLF.file')->hexdigest, "26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa", 'keccak224 (OO/file/3)');
95 {
96 open(my $fh, '<', 't/data/text-CRLF.file');
97 binmode($fh);
98 is( Crypt::Digest::Keccak224->new->addfile($fh)->hexdigest, "26659008759423cde44c4984748af6b61d7d4ea5c7e81be58fb72faa", 'keccak224 (OO/filehandle/3)');
99 close($fh);
100 }
101
102 is( keccak224_file('t/data/text-LF.file'), pack("H*","2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b"), 'keccak224 (raw/file/4)');
103 is( keccak224_file_hex('t/data/text-LF.file'), "2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b", 'keccak224 (hex/file/4)');
104 is( keccak224_file_b64('t/data/text-LF.file'), "ICFxfRb5n0k5YNCDmjyysBvoB4wotCXX8chmKw==", 'keccak224 (base64/file/4)');
105 is( digest_file('Keccak224', 't/data/text-LF.file'), pack("H*","2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b"), 'keccak224 (digest_file_raw/file/4)');
106 is( digest_file_hex('Keccak224', 't/data/text-LF.file'), "2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b", 'keccak224 (digest_file_hex/file/4)');
107 is( digest_file_b64('Keccak224', 't/data/text-LF.file'), "ICFxfRb5n0k5YNCDmjyysBvoB4wotCXX8chmKw==", 'keccak224 (digest_file_b64/file/4)');
108 is( digest_file_b64u('Keccak224', 't/data/text-LF.file'), "ICFxfRb5n0k5YNCDmjyysBvoB4wotCXX8chmKw", 'keccak224 (digest_file_b64u/file/4)');
109 is( Crypt::Digest::Keccak224->new->addfile('t/data/text-LF.file')->hexdigest, "2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b", 'keccak224 (OO/file/4)');
110 {
111 open(my $fh, '<', 't/data/text-LF.file');
112 binmode($fh);
113 is( Crypt::Digest::Keccak224->new->addfile($fh)->hexdigest, "2021717d16f99f493960d0839a3cb2b01be8078c28b425d7f1c8662b", 'keccak224 (OO/filehandle/4)');
114 close($fh);
115 }
0 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
1
2 use strict;
3 use warnings;
4
5 use Test::More tests => 8*3 + 9*4 + 10 + 6;
6
7 use Crypt::Digest qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u );
8 use Crypt::Digest::Keccak256 qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u );
9
10 is( Crypt::Digest::hashsize('Keccak256'), 32, 'hashsize/1');
11 is( Crypt::Digest->hashsize('Keccak256'), 32, 'hashsize/2');
12 is( Crypt::Digest::Keccak256::hashsize, 32, 'hashsize/3');
13 is( Crypt::Digest::Keccak256->hashsize, 32, 'hashsize/4');
14 is( Crypt::Digest->new('Keccak256')->hashsize, 32, 'hashsize/5');
15 is( Crypt::Digest::Keccak256->new->hashsize, 32, 'hashsize/6');
16
17 is( keccak256("A","A","A"), pack("H*","2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a"), 'keccak256 (raw/tripple_A)');
18 is( keccak256_hex("A","A","A"), "2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a", 'keccak256 (hex/tripple_A)');
19 is( keccak256_b64("A","A","A"), "IHBQQAOge0cT14OuemZCqzuVm3xXXG5PpPM+t0PbYxo=", 'keccak256 (base64/tripple_A)');
20 is( keccak256_b64u("A","A","A"), "IHBQQAOge0cT14OuemZCqzuVm3xXXG5PpPM-t0PbYxo", 'keccak256 (base64url/tripple_A)');
21 is( digest_data('Keccak256', "A","A","A"), pack("H*","2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a"), 'keccak256 (digest_data_raw/tripple_A)');
22 is( digest_data_hex('Keccak256', "A","A","A"), "2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a", 'keccak256 (digest_data_hex/tripple_A)');
23 is( digest_data_b64('Keccak256', "A","A","A"), "IHBQQAOge0cT14OuemZCqzuVm3xXXG5PpPM+t0PbYxo=", 'keccak256 (digest_data_b64/tripple_A)');
24 is( digest_data_b64u('Keccak256', "A","A","A"), "IHBQQAOge0cT14OuemZCqzuVm3xXXG5PpPM-t0PbYxo", 'keccak256 (digest_data_b64u/tripple_A)');
25 is( Crypt::Digest::Keccak256->new->add("A","A","A")->hexdigest, "2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a", 'keccak256 (OO/tripple_A)');
26 is( Crypt::Digest::Keccak256->new->add("A")->add("A")->add("A")->hexdigest, "2070504003a07b4713d783ae7a6642ab3b959b7c575c6e4fa4f33eb743db631a", 'keccak256 (OO3/tripple_A)');
27
28
29 is( keccak256(""), pack("H*","c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"), 'keccak256 (raw/1)');
30 is( keccak256_hex(""), "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", 'keccak256 (hex/1)');
31 is( keccak256_b64(""), "xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e/rYBF2FpHA=", 'keccak256 (base64/1)');
32 is( digest_data('Keccak256', ""), pack("H*","c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"), 'keccak256 (digest_data_raw/1)');
33 is( digest_data_hex('Keccak256', ""), "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", 'keccak256 (digest_data_hex/1)');
34 is( digest_data_b64('Keccak256', ""), "xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e/rYBF2FpHA=", 'keccak256 (digest_data_b64/1)');
35 is( digest_data_b64u('Keccak256', ""), "xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e_rYBF2FpHA", 'keccak256 (digest_data_b64u/1)');
36 is( Crypt::Digest::Keccak256->new->add("")->hexdigest, "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", 'keccak256 (OO/1)');
37
38 is( keccak256("123"), pack("H*","64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"), 'keccak256 (raw/2)');
39 is( keccak256_hex("123"), "64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107", 'keccak256 (hex/2)');
40 is( keccak256_b64("123"), "ZOYEeHy/GUhB57aNfNKHhvbJoKOrn4sKDofLQ4erAQc=", 'keccak256 (base64/2)');
41 is( digest_data('Keccak256', "123"), pack("H*","64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"), 'keccak256 (digest_data_raw/2)');
42 is( digest_data_hex('Keccak256', "123"), "64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107", 'keccak256 (digest_data_hex/2)');
43 is( digest_data_b64('Keccak256', "123"), "ZOYEeHy/GUhB57aNfNKHhvbJoKOrn4sKDofLQ4erAQc=", 'keccak256 (digest_data_b64/2)');
44 is( digest_data_b64u('Keccak256', "123"), "ZOYEeHy_GUhB57aNfNKHhvbJoKOrn4sKDofLQ4erAQc", 'keccak256 (digest_data_b64u/2)');
45 is( Crypt::Digest::Keccak256->new->add("123")->hexdigest, "64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107", 'keccak256 (OO/2)');
46
47 is( keccak256("test\0test\0test\n"), pack("H*","fbc121310d505fb7172a28e0e9e8c7d2976c9f63a739fe60bc298467bc72bb86"), 'keccak256 (raw/3)');
48 is( keccak256_hex("test\0test\0test\n"), "fbc121310d505fb7172a28e0e9e8c7d2976c9f63a739fe60bc298467bc72bb86", 'keccak256 (hex/3)');
49 is( keccak256_b64("test\0test\0test\n"), "+8EhMQ1QX7cXKijg6ejH0pdsn2OnOf5gvCmEZ7xyu4Y=", 'keccak256 (base64/3)');
50 is( digest_data('Keccak256', "test\0test\0test\n"), pack("H*","fbc121310d505fb7172a28e0e9e8c7d2976c9f63a739fe60bc298467bc72bb86"), 'keccak256 (digest_data_raw/3)');
51 is( digest_data_hex('Keccak256', "test\0test\0test\n"), "fbc121310d505fb7172a28e0e9e8c7d2976c9f63a739fe60bc298467bc72bb86", 'keccak256 (digest_data_hex/3)');
52 is( digest_data_b64('Keccak256', "test\0test\0test\n"), "+8EhMQ1QX7cXKijg6ejH0pdsn2OnOf5gvCmEZ7xyu4Y=", 'keccak256 (digest_data_b64/3)');
53 is( digest_data_b64u('Keccak256', "test\0test\0test\n"), "-8EhMQ1QX7cXKijg6ejH0pdsn2OnOf5gvCmEZ7xyu4Y", 'keccak256 (digest_data_b64u/3)');
54 is( Crypt::Digest::Keccak256->new->add("test\0test\0test\n")->hexdigest, "fbc121310d505fb7172a28e0e9e8c7d2976c9f63a739fe60bc298467bc72bb86", 'keccak256 (OO/3)');
55
56
57 is( keccak256_file('t/data/binary-test.file'), pack("H*","7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8"), 'keccak256 (raw/file/1)');
58 is( keccak256_file_hex('t/data/binary-test.file'), "7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8", 'keccak256 (hex/file/1)');
59 is( keccak256_file_b64('t/data/binary-test.file'), "cEb1+tds95Oh9EwVm2Vid62j9CgFesgWDQT9zcWw/Lg=", 'keccak256 (base64/file/1)');
60 is( digest_file('Keccak256', 't/data/binary-test.file'), pack("H*","7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8"), 'keccak256 (digest_file_raw/file/1)');
61 is( digest_file_hex('Keccak256', 't/data/binary-test.file'), "7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8", 'keccak256 (digest_file_hex/file/1)');
62 is( digest_file_b64('Keccak256', 't/data/binary-test.file'), "cEb1+tds95Oh9EwVm2Vid62j9CgFesgWDQT9zcWw/Lg=", 'keccak256 (digest_file_b64/file/1)');
63 is( digest_file_b64u('Keccak256', 't/data/binary-test.file'), "cEb1-tds95Oh9EwVm2Vid62j9CgFesgWDQT9zcWw_Lg", 'keccak256 (digest_file_b64u/file/1)');
64 is( Crypt::Digest::Keccak256->new->addfile('t/data/binary-test.file')->hexdigest, "7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8", 'keccak256 (OO/file/1)');
65 {
66 open(my $fh, '<', 't/data/binary-test.file');
67 binmode($fh);
68 is( Crypt::Digest::Keccak256->new->addfile($fh)->hexdigest, "7046f5fad76cf793a1f44c159b656277ada3f428057ac8160d04fdcdc5b0fcb8", 'keccak256 (OO/filehandle/1)');
69 close($fh);
70 }
71
72 is( keccak256_file('t/data/text-CR.file'), pack("H*","288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18"), 'keccak256 (raw/file/2)');
73 is( keccak256_file_hex('t/data/text-CR.file'), "288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18", 'keccak256 (hex/file/2)');
74 is( keccak256_file_b64('t/data/text-CR.file'), "KI1HiXIipvvW2Fk80GeW5sPrVjem6vj8Az3JJDzgHBg=", 'keccak256 (base64/file/2)');
75 is( digest_file('Keccak256', 't/data/text-CR.file'), pack("H*","288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18"), 'keccak256 (digest_file_raw/file/2)');
76 is( digest_file_hex('Keccak256', 't/data/text-CR.file'), "288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18", 'keccak256 (digest_file_hex/file/2)');
77 is( digest_file_b64('Keccak256', 't/data/text-CR.file'), "KI1HiXIipvvW2Fk80GeW5sPrVjem6vj8Az3JJDzgHBg=", 'keccak256 (digest_file_b64/file/2)');
78 is( digest_file_b64u('Keccak256', 't/data/text-CR.file'), "KI1HiXIipvvW2Fk80GeW5sPrVjem6vj8Az3JJDzgHBg", 'keccak256 (digest_file_b64u/file/2)');
79 is( Crypt::Digest::Keccak256->new->addfile('t/data/text-CR.file')->hexdigest, "288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18", 'keccak256 (OO/file/2)');
80 {
81 open(my $fh, '<', 't/data/text-CR.file');
82 binmode($fh);
83 is( Crypt::Digest::Keccak256->new->addfile($fh)->hexdigest, "288d47897222a6fbd6d8593cd06796e6c3eb5637a6eaf8fc033dc9243ce01c18", 'keccak256 (OO/filehandle/2)');
84 close($fh);
85 }
86
87 is( keccak256_file('t/data/text-CRLF.file'), pack("H*","a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1"), 'keccak256 (raw/file/3)');
88 is( keccak256_file_hex('t/data/text-CRLF.file'), "a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1", 'keccak256 (hex/file/3)');
89 is( keccak256_file_b64('t/data/text-CRLF.file'), "pEcDuF1e5/NbPAwhxkbWlZeNDsXqNqGgWndCfF+WTuE=", 'keccak256 (base64/file/3)');
90 is( digest_file('Keccak256', 't/data/text-CRLF.file'), pack("H*","a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1"), 'keccak256 (digest_file_raw/file/3)');
91 is( digest_file_hex('Keccak256', 't/data/text-CRLF.file'), "a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1", 'keccak256 (digest_file_hex/file/3)');
92 is( digest_file_b64('Keccak256', 't/data/text-CRLF.file'), "pEcDuF1e5/NbPAwhxkbWlZeNDsXqNqGgWndCfF+WTuE=", 'keccak256 (digest_file_b64/file/3)');
93 is( digest_file_b64u('Keccak256', 't/data/text-CRLF.file'), "pEcDuF1e5_NbPAwhxkbWlZeNDsXqNqGgWndCfF-WTuE", 'keccak256 (digest_file_b64u/file/3)');
94 is( Crypt::Digest::Keccak256->new->addfile('t/data/text-CRLF.file')->hexdigest, "a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1", 'keccak256 (OO/file/3)');
95 {
96 open(my $fh, '<', 't/data/text-CRLF.file');
97 binmode($fh);
98 is( Crypt::Digest::Keccak256->new->addfile($fh)->hexdigest, "a44703b85d5ee7f35b3c0c21c646d695978d0ec5ea36a1a05a77427c5f964ee1", 'keccak256 (OO/filehandle/3)');
99 close($fh);
100 }
101
102 is( keccak256_file('t/data/text-LF.file'), pack("H*","188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4"), 'keccak256 (raw/file/4)');
103 is( keccak256_file_hex('t/data/text-LF.file'), "188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4", 'keccak256 (hex/file/4)');
104 is( keccak256_file_b64('t/data/text-LF.file'), "GIR2xx3ir8t+2p28VgteteTmgaVYVopBBo621zjvpPQ=", 'keccak256 (base64/file/4)');
105 is( digest_file('Keccak256', 't/data/text-LF.file'), pack("H*","188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4"), 'keccak256 (digest_file_raw/file/4)');
106 is( digest_file_hex('Keccak256', 't/data/text-LF.file'), "188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4", 'keccak256 (digest_file_hex/file/4)');
107 is( digest_file_b64('Keccak256', 't/data/text-LF.file'), "GIR2xx3ir8t+2p28VgteteTmgaVYVopBBo621zjvpPQ=", 'keccak256 (digest_file_b64/file/4)');
108 is( digest_file_b64u('Keccak256', 't/data/text-LF.file'), "GIR2xx3ir8t-2p28VgteteTmgaVYVopBBo621zjvpPQ", 'keccak256 (digest_file_b64u/file/4)');
109 is( Crypt::Digest::Keccak256->new->addfile('t/data/text-LF.file')->hexdigest, "188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4", 'keccak256 (OO/file/4)');
110 {
111 open(my $fh, '<', 't/data/text-LF.file');
112 binmode($fh);
113 is( Crypt::Digest::Keccak256->new->addfile($fh)->hexdigest, "188476c71de2afcb7eda9dbc560b5eb5e4e681a558568a41068eb6d738efa4f4", 'keccak256 (OO/filehandle/4)');
114 close($fh);
115 }
0 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
1
2 use strict;
3 use warnings;
4
5 use Test::More tests => 8*3 + 9*4 + 10 + 6;
6
7 use Crypt::Digest qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u );
8 use Crypt::Digest::Keccak384 qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u );
9
10 is( Crypt::Digest::hashsize('Keccak384'), 48, 'hashsize/1');
11 is( Crypt::Digest->hashsize('Keccak384'), 48, 'hashsize/2');
12 is( Crypt::Digest::Keccak384::hashsize, 48, 'hashsize/3');
13 is( Crypt::Digest::Keccak384->hashsize, 48, 'hashsize/4');
14 is( Crypt::Digest->new('Keccak384')->hashsize, 48, 'hashsize/5');
15 is( Crypt::Digest::Keccak384->new->hashsize, 48, 'hashsize/6');
16
17 is( keccak384("A","A","A"), pack("H*","173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297"), 'keccak384 (raw/tripple_A)');
18 is( keccak384_hex("A","A","A"), "173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297", 'keccak384 (hex/tripple_A)');
19 is( keccak384_b64("A","A","A"), "FztUXg/YF4T4wCTKgDZBk2CC7vmlrOc/r3OtaOzeYCnMNFpcVJOE4Ndifcv1jQKX", 'keccak384 (base64/tripple_A)');
20 is( keccak384_b64u("A","A","A"), "FztUXg_YF4T4wCTKgDZBk2CC7vmlrOc_r3OtaOzeYCnMNFpcVJOE4Ndifcv1jQKX", 'keccak384 (base64url/tripple_A)');
21 is( digest_data('Keccak384', "A","A","A"), pack("H*","173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297"), 'keccak384 (digest_data_raw/tripple_A)');
22 is( digest_data_hex('Keccak384', "A","A","A"), "173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297", 'keccak384 (digest_data_hex/tripple_A)');
23 is( digest_data_b64('Keccak384', "A","A","A"), "FztUXg/YF4T4wCTKgDZBk2CC7vmlrOc/r3OtaOzeYCnMNFpcVJOE4Ndifcv1jQKX", 'keccak384 (digest_data_b64/tripple_A)');
24 is( digest_data_b64u('Keccak384', "A","A","A"), "FztUXg_YF4T4wCTKgDZBk2CC7vmlrOc_r3OtaOzeYCnMNFpcVJOE4Ndifcv1jQKX", 'keccak384 (digest_data_b64u/tripple_A)');
25 is( Crypt::Digest::Keccak384->new->add("A","A","A")->hexdigest, "173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297", 'keccak384 (OO/tripple_A)');
26 is( Crypt::Digest::Keccak384->new->add("A")->add("A")->add("A")->hexdigest, "173b545e0fd81784f8c024ca803641936082eef9a5ace73faf73ad68ecde6029cc345a5c549384e0d7627dcbf58d0297", 'keccak384 (OO3/tripple_A)');
27
28
29 is( keccak384(""), pack("H*","2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff"), 'keccak384 (raw/1)');
30 is( keccak384_hex(""), "2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff", 'keccak384 (hex/1)');
31 is( keccak384_b64(""), "LCMUamOims+Z5zuI+MJOqn3GCqdxeAzMAGr7+o/iR5st0rITYjN0QawStRWRGVf/", 'keccak384 (base64/1)');
32 is( digest_data('Keccak384', ""), pack("H*","2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff"), 'keccak384 (digest_data_raw/1)');
33 is( digest_data_hex('Keccak384', ""), "2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff", 'keccak384 (digest_data_hex/1)');
34 is( digest_data_b64('Keccak384', ""), "LCMUamOims+Z5zuI+MJOqn3GCqdxeAzMAGr7+o/iR5st0rITYjN0QawStRWRGVf/", 'keccak384 (digest_data_b64/1)');
35 is( digest_data_b64u('Keccak384', ""), "LCMUamOims-Z5zuI-MJOqn3GCqdxeAzMAGr7-o_iR5st0rITYjN0QawStRWRGVf_", 'keccak384 (digest_data_b64u/1)');
36 is( Crypt::Digest::Keccak384->new->add("")->hexdigest, "2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff", 'keccak384 (OO/1)');
37
38 is( keccak384("123"), pack("H*","7dd34ccaae92bfc7eb541056d200db23b6bbeefe95be0d2bb43625113361906f0afc701dbef1cfb615bf98b1535a84c1"), 'keccak384 (raw/2)');
39 is( keccak384_hex("123"), "7dd34ccaae92bfc7eb541056d200db23b6bbeefe95be0d2bb43625113361906f0afc701dbef1cfb615bf98b1535a84c1", 'keccak384 (hex/2)');
40 is( keccak384_b64("123"), "fdNMyq6Sv8frVBBW0gDbI7a77v6Vvg0rtDYlETNhkG8K/HAdvvHPthW/mLFTWoTB", 'keccak384 (base64/2)');
41 is( digest_data('Keccak384', "123"), pack("H*","7dd34ccaae92bfc7eb541056d200db23b6bbeefe95be0d2bb43625113361906f0afc701dbef1cfb615bf98b1535a84c1"), 'keccak384 (digest_data_raw/2)');
42 is( digest_data_hex('Keccak384', "123"), "7dd34ccaae92bfc7eb541056d200db23b6bbeefe95be0d2bb43625113361906f0afc701dbef1cfb615bf98b1535a84c1", 'keccak384 (digest_data_hex/2)');
43 is( digest_data_b64('Keccak384', "123"), "fdNMyq6Sv8frVBBW0gDbI7a77v6Vvg0rtDYlETNhkG8K/HAdvvHPthW/mLFTWoTB", 'keccak384 (digest_data_b64/2)');
44 is( digest_data_b64u('Keccak384', "123"), "fdNMyq6Sv8frVBBW0gDbI7a77v6Vvg0rtDYlETNhkG8K_HAdvvHPthW_mLFTWoTB", 'keccak384 (digest_data_b64u/2)');
45 is( Crypt::Digest::Keccak384->new->add("123")->hexdigest, "7dd34ccaae92bfc7eb541056d200db23b6bbeefe95be0d2bb43625113361906f0afc701dbef1cfb615bf98b1535a84c1", 'keccak384 (OO/2)');
46
47 is( keccak384("test\0test\0test\n"), pack("H*","d05c31062f5401c5d370cf84949937c52764626a61d2bbd5bf5c50f6f742ebcf9269691a3c70ef83dc49f4e186e5d908"), 'keccak384 (raw/3)');
48 is( keccak384_hex("test\0test\0test\n"), "d05c31062f5401c5d370cf84949937c52764626a61d2bbd5bf5c50f6f742ebcf9269691a3c70ef83dc49f4e186e5d908", 'keccak384 (hex/3)');
49 is( keccak384_b64("test\0test\0test\n"), "0FwxBi9UAcXTcM+ElJk3xSdkYmph0rvVv1xQ9vdC68+SaWkaPHDvg9xJ9OGG5dkI", 'keccak384 (base64/3)');
50 is( digest_data('Keccak384', "test\0test\0test\n"), pack("H*","d05c31062f5401c5d370cf84949937c52764626a61d2bbd5bf5c50f6f742ebcf9269691a3c70ef83dc49f4e186e5d908"), 'keccak384 (digest_data_raw/3)');
51 is( digest_data_hex('Keccak384', "test\0test\0test\n"), "d05c31062f5401c5d370cf84949937c52764626a61d2bbd5bf5c50f6f742ebcf9269691a3c70ef83dc49f4e186e5d908", 'keccak384 (digest_data_hex/3)');
52 is( digest_data_b64('Keccak384', "test\0test\0test\n"), "0FwxBi9UAcXTcM+ElJk3xSdkYmph0rvVv1xQ9vdC68+SaWkaPHDvg9xJ9OGG5dkI", 'keccak384 (digest_data_b64/3)');
53 is( digest_data_b64u('Keccak384', "test\0test\0test\n"), "0FwxBi9UAcXTcM-ElJk3xSdkYmph0rvVv1xQ9vdC68-SaWkaPHDvg9xJ9OGG5dkI", 'keccak384 (digest_data_b64u/3)');
54 is( Crypt::Digest::Keccak384->new->add("test\0test\0test\n")->hexdigest, "d05c31062f5401c5d370cf84949937c52764626a61d2bbd5bf5c50f6f742ebcf9269691a3c70ef83dc49f4e186e5d908", 'keccak384 (OO/3)');
55
56
57 is( keccak384_file('t/data/binary-test.file'), pack("H*","16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc"), 'keccak384 (raw/file/1)');
58 is( keccak384_file_hex('t/data/binary-test.file'), "16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc", 'keccak384 (hex/file/1)');
59 is( keccak384_file_b64('t/data/binary-test.file'), "FqWn2C3h7sHLu1HEA90PwCVg3fSIwbjGm5tM8VhedRQk38wGzwuvL/c9kxxvckC8", 'keccak384 (base64/file/1)');
60 is( digest_file('Keccak384', 't/data/binary-test.file'), pack("H*","16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc"), 'keccak384 (digest_file_raw/file/1)');
61 is( digest_file_hex('Keccak384', 't/data/binary-test.file'), "16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc", 'keccak384 (digest_file_hex/file/1)');
62 is( digest_file_b64('Keccak384', 't/data/binary-test.file'), "FqWn2C3h7sHLu1HEA90PwCVg3fSIwbjGm5tM8VhedRQk38wGzwuvL/c9kxxvckC8", 'keccak384 (digest_file_b64/file/1)');
63 is( digest_file_b64u('Keccak384', 't/data/binary-test.file'), "FqWn2C3h7sHLu1HEA90PwCVg3fSIwbjGm5tM8VhedRQk38wGzwuvL_c9kxxvckC8", 'keccak384 (digest_file_b64u/file/1)');
64 is( Crypt::Digest::Keccak384->new->addfile('t/data/binary-test.file')->hexdigest, "16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc", 'keccak384 (OO/file/1)');
65 {
66 open(my $fh, '<', 't/data/binary-test.file');
67 binmode($fh);
68 is( Crypt::Digest::Keccak384->new->addfile($fh)->hexdigest, "16a5a7d82de1eec1cbbb51c403dd0fc02560ddf488c1b8c69b9b4cf1585e751424dfcc06cf0baf2ff73d931c6f7240bc", 'keccak384 (OO/filehandle/1)');
69 close($fh);
70 }
71
72 is( keccak384_file('t/data/text-CR.file'), pack("H*","d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc"), 'keccak384 (raw/file/2)');
73 is( keccak384_file_hex('t/data/text-CR.file'), "d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc", 'keccak384 (hex/file/2)');
74 is( keccak384_file_b64('t/data/text-CR.file'), "1CoL+yqVu/66N1sUbr4375ly0lgJuToY/RdU+4atkTmsLKceXNFxMCTs2gYmOjnM", 'keccak384 (base64/file/2)');
75 is( digest_file('Keccak384', 't/data/text-CR.file'), pack("H*","d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc"), 'keccak384 (digest_file_raw/file/2)');
76 is( digest_file_hex('Keccak384', 't/data/text-CR.file'), "d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc", 'keccak384 (digest_file_hex/file/2)');
77 is( digest_file_b64('Keccak384', 't/data/text-CR.file'), "1CoL+yqVu/66N1sUbr4375ly0lgJuToY/RdU+4atkTmsLKceXNFxMCTs2gYmOjnM", 'keccak384 (digest_file_b64/file/2)');
78 is( digest_file_b64u('Keccak384', 't/data/text-CR.file'), "1CoL-yqVu_66N1sUbr4375ly0lgJuToY_RdU-4atkTmsLKceXNFxMCTs2gYmOjnM", 'keccak384 (digest_file_b64u/file/2)');
79 is( Crypt::Digest::Keccak384->new->addfile('t/data/text-CR.file')->hexdigest, "d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc", 'keccak384 (OO/file/2)');
80 {
81 open(my $fh, '<', 't/data/text-CR.file');
82 binmode($fh);
83 is( Crypt::Digest::Keccak384->new->addfile($fh)->hexdigest, "d42a0bfb2a95bbfeba375b146ebe37ef9972d25809b93a18fd1754fb86ad9139ac2ca71e5cd1713024ecda06263a39cc", 'keccak384 (OO/filehandle/2)');
84 close($fh);
85 }
86
87 is( keccak384_file('t/data/text-CRLF.file'), pack("H*","06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982"), 'keccak384 (raw/file/3)');
88 is( keccak384_file_hex('t/data/text-CRLF.file'), "06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982", 'keccak384 (hex/file/3)');
89 is( keccak384_file_b64('t/data/text-CRLF.file'), "BiiLNQblCArrvN+qulmFrInj5CJ/0yuKUyZABkyYv+qZGl6IzACzB/0N0tHIejmC", 'keccak384 (base64/file/3)');
90 is( digest_file('Keccak384', 't/data/text-CRLF.file'), pack("H*","06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982"), 'keccak384 (digest_file_raw/file/3)');
91 is( digest_file_hex('Keccak384', 't/data/text-CRLF.file'), "06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982", 'keccak384 (digest_file_hex/file/3)');
92 is( digest_file_b64('Keccak384', 't/data/text-CRLF.file'), "BiiLNQblCArrvN+qulmFrInj5CJ/0yuKUyZABkyYv+qZGl6IzACzB/0N0tHIejmC", 'keccak384 (digest_file_b64/file/3)');
93 is( digest_file_b64u('Keccak384', 't/data/text-CRLF.file'), "BiiLNQblCArrvN-qulmFrInj5CJ_0yuKUyZABkyYv-qZGl6IzACzB_0N0tHIejmC", 'keccak384 (digest_file_b64u/file/3)');
94 is( Crypt::Digest::Keccak384->new->addfile('t/data/text-CRLF.file')->hexdigest, "06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982", 'keccak384 (OO/file/3)');
95 {
96 open(my $fh, '<', 't/data/text-CRLF.file');
97 binmode($fh);
98 is( Crypt::Digest::Keccak384->new->addfile($fh)->hexdigest, "06288b3506e5080aebbcdfaaba5985ac89e3e4227fd32b8a532640064c98bfea991a5e88cc00b307fd0dd2d1c87a3982", 'keccak384 (OO/filehandle/3)');
99 close($fh);
100 }
101
102 is( keccak384_file('t/data/text-LF.file'), pack("H*","14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71"), 'keccak384 (raw/file/4)');
103 is( keccak384_file_hex('t/data/text-LF.file'), "14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71", 'keccak384 (hex/file/4)');
104 is( keccak384_file_b64('t/data/text-LF.file'), "FLVNEYgVT3AX/3sz4h5C75PJHXnqa0SiIwAq3G2JuHXTvLJcGJrqgnVgVAr75c9x", 'keccak384 (base64/file/4)');
105 is( digest_file('Keccak384', 't/data/text-LF.file'), pack("H*","14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71"), 'keccak384 (digest_file_raw/file/4)');
106 is( digest_file_hex('Keccak384', 't/data/text-LF.file'), "14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71", 'keccak384 (digest_file_hex/file/4)');
107 is( digest_file_b64('Keccak384', 't/data/text-LF.file'), "FLVNEYgVT3AX/3sz4h5C75PJHXnqa0SiIwAq3G2JuHXTvLJcGJrqgnVgVAr75c9x", 'keccak384 (digest_file_b64/file/4)');
108 is( digest_file_b64u('Keccak384', 't/data/text-LF.file'), "FLVNEYgVT3AX_3sz4h5C75PJHXnqa0SiIwAq3G2JuHXTvLJcGJrqgnVgVAr75c9x", 'keccak384 (digest_file_b64u/file/4)');
109 is( Crypt::Digest::Keccak384->new->addfile('t/data/text-LF.file')->hexdigest, "14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71", 'keccak384 (OO/file/4)');
110 {
111 open(my $fh, '<', 't/data/text-LF.file');
112 binmode($fh);
113 is( Crypt::Digest::Keccak384->new->addfile($fh)->hexdigest, "14b54d1188154f7017ff7b33e21e42ef93c91d79ea6b44a223002adc6d89b875d3bcb25c189aea827560540afbe5cf71", 'keccak384 (OO/filehandle/4)');
114 close($fh);
115 }
0 ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
1
2 use strict;
3 use warnings;
4
5 use Test::More tests => 8*3 + 9*4 + 10 + 6;
6
7 use Crypt::Digest qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u );
8 use Crypt::Digest::Keccak512 qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u );
9
10 is( Crypt::Digest::hashsize('Keccak512'), 64, 'hashsize/1');
11 is( Crypt::Digest->hashsize('Keccak512'), 64, 'hashsize/2');
12 is( Crypt::Digest::Keccak512::hashsize, 64, 'hashsize/3');
13 is( Crypt::Digest::Keccak512->hashsize, 64, 'hashsize/4');
14 is( Crypt::Digest->new('Keccak512')->hashsize, 64, 'hashsize/5');
15 is( Crypt::Digest::Keccak512->new->hashsize, 64, 'hashsize/6');
16
17 is( keccak512("A","A","A"), pack("H*","a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391"), 'keccak512 (raw/tripple_A)');
18 is( keccak512_hex("A","A","A"), "a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391", 'keccak512 (hex/tripple_A)');
19 is( keccak512_b64("A","A","A"), "oCQ6iRWE9IrrWWd0WHBdIJwN79l3ZVy4pseCmKydWYFXFlnh01AkKF1xjdH2A4dq14X1nqgUuR7mGkQzhWxjkQ==", 'keccak512 (base64/tripple_A)');
20 is( keccak512_b64u("A","A","A"), "oCQ6iRWE9IrrWWd0WHBdIJwN79l3ZVy4pseCmKydWYFXFlnh01AkKF1xjdH2A4dq14X1nqgUuR7mGkQzhWxjkQ", 'keccak512 (base64url/tripple_A)');
21 is( digest_data('Keccak512', "A","A","A"), pack("H*","a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391"), 'keccak512 (digest_data_raw/tripple_A)');
22 is( digest_data_hex('Keccak512', "A","A","A"), "a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391", 'keccak512 (digest_data_hex/tripple_A)');
23 is( digest_data_b64('Keccak512', "A","A","A"), "oCQ6iRWE9IrrWWd0WHBdIJwN79l3ZVy4pseCmKydWYFXFlnh01AkKF1xjdH2A4dq14X1nqgUuR7mGkQzhWxjkQ==", 'keccak512 (digest_data_b64/tripple_A)');
24 is( digest_data_b64u('Keccak512', "A","A","A"), "oCQ6iRWE9IrrWWd0WHBdIJwN79l3ZVy4pseCmKydWYFXFlnh01AkKF1xjdH2A4dq14X1nqgUuR7mGkQzhWxjkQ", 'keccak512 (digest_data_b64u/tripple_A)');
25 is( Crypt::Digest::Keccak512->new->add("A","A","A")->hexdigest, "a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391", 'keccak512 (OO/tripple_A)');
26 is( Crypt::Digest::Keccak512->new->add("A")->add("A")->add("A")->hexdigest, "a0243a891584f48aeb59677458705d209c0defd977655cb8a6c78298ac9d5981571659e1d35024285d718dd1f603876ad785f59ea814b91ee61a4433856c6391", 'keccak512 (OO3/tripple_A)');
27
28
29 is( keccak512(""), pack("H*","0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e"), 'keccak512 (raw/1)');
30 is( keccak512_hex(""), "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e", 'keccak512 (hex/1)');
31 is( keccak512_b64(""), "DqtC3kw865I1/JGs/+dGspwpqMNmt8YOTmfEZvNqQwTAD6nK+dh5drpGm8vgZxO0NfCR7ydp+xYM2rM9NnBoDg==", 'keccak512 (base64/1)');
32 is( digest_data('Keccak512', ""), pack("H*","0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e"), 'keccak512 (digest_data_raw/1)');
33 is( digest_data_hex('Keccak512', ""), "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e", 'keccak512 (digest_data_hex/1)');
34 is( digest_data_b64('Keccak512', ""), "DqtC3kw865I1/JGs/+dGspwpqMNmt8YOTmfEZvNqQwTAD6nK+dh5drpGm8vgZxO0NfCR7ydp+xYM2rM9NnBoDg==", 'keccak512 (digest_data_b64/1)');
35 is( digest_data_b64u('Keccak512', ""), "DqtC3kw865I1_JGs_-dGspwpqMNmt8YOTmfEZvNqQwTAD6nK-dh5drpGm8vgZxO0NfCR7ydp-xYM2rM9NnBoDg", 'keccak512 (digest_data_b64u/1)');
36 is( Crypt::Digest::Keccak512->new->add("")->hexdigest, "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e", 'keccak512 (OO/1)');
37
38 is( keccak512("123"), pack("H*","8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d"), 'keccak512 (raw/2)');
39 is( keccak512_hex("123"), "8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d", 'keccak512 (hex/2)');
40 is( keccak512_b64("123"), "jKMtlQhz/StbNKfXnEopSy/YBavjJhvrBPq2GjtLdWCa/WR4qo004D8mLWi7CaK6nWVeIoyWcjsoVIOKbmE7nQ==", 'keccak512 (base64/2)');
41 is( digest_data('Keccak512', "123"), pack("H*","8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d"), 'keccak512 (digest_data_raw/2)');
42 is( digest_data_hex('Keccak512', "123"), "8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d", 'keccak512 (digest_data_hex/2)');
43 is( digest_data_b64('Keccak512', "123"), "jKMtlQhz/StbNKfXnEopSy/YBavjJhvrBPq2GjtLdWCa/WR4qo004D8mLWi7CaK6nWVeIoyWcjsoVIOKbmE7nQ==", 'keccak512 (digest_data_b64/2)');
44 is( digest_data_b64u('Keccak512', "123"), "jKMtlQhz_StbNKfXnEopSy_YBavjJhvrBPq2GjtLdWCa_WR4qo004D8mLWi7CaK6nWVeIoyWcjsoVIOKbmE7nQ", 'keccak512 (digest_data_b64u/2)');
45 is( Crypt::Digest::Keccak512->new->add("123")->hexdigest, "8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d", 'keccak512 (OO/2)');
46
47 is( keccak512("test\0test\0test\n"), pack("H*","32c764ac224dfa7a5c8205dada12006a56d15a6377b6fcd65b6e17be8759459ae847d9d7cadf335d4b477541db19883a4d4a7e2dae8f9f8504f4e36cc3417e00"), 'keccak512 (raw/3)');
48 is( keccak512_hex("test\0test\0test\n"), "32c764ac224dfa7a5c8205dada12006a56d15a6377b6fcd65b6e17be8759459ae847d9d7cadf335d4b477541db19883a4d4a7e2dae8f9f8504f4e36cc3417e00", 'keccak512 (hex/3)');
49 is( keccak512_b64("test\0test\0test\n"), "MsdkrCJN+npcggXa2hIAalbRWmN3tvzWW24XvodZRZroR9nXyt8zXUtHdUHbGYg6TUp+La6Pn4UE9ONsw0F+AA==", 'keccak512 (base64/3)');
50 is( digest_data('Keccak512', "test\0test\0test\n"), pack("H*","32c764ac224dfa7a5c8205dada12006a56d15a6377b6fcd65b6e17be8759459ae847d9d7cadf335d4b477541db19883a4d4a7e2dae8f9f8504f4e36cc3417e00"), 'keccak512 (digest_data_raw/3)');
51 is( digest_data_hex('Keccak512', "test\0test\0test\n"), "32c764ac224dfa7a5c8205dada12006a56d15a6377b6fcd65b6e17be8759459ae847d9d7cadf335d4b477541db19883a4d4a7e2dae8f9f8504f4e36cc3417e00", 'keccak512 (digest_data_hex/3)');
52 is( digest_data_b64('Keccak512', "test\0test\0test\n"), "MsdkrCJN+npcggXa2hIAalbRWmN3tvzWW24XvodZRZroR9nXyt8zXUtHdUHbGYg6TUp+La6Pn4UE9ONsw0F+AA==", 'keccak512 (digest_data_b64/3)');
53 is( digest_data_b64u('Keccak512', "test\0test\0test\n"), "MsdkrCJN-npcggXa2hIAalbRWmN3tvzWW24XvodZRZroR9nXyt8zXUtHdUHbGYg6TUp-La6Pn4UE9ONsw0F-AA", 'keccak512 (digest_data_b64u/3)');
54 is( Crypt::Digest::Keccak512->new->add("test\0test\0test\n")->hexdigest, "32c764ac224dfa7a5c8205dada12006a56d15a6377b6fcd65b6e17be8759459ae847d9d7cadf335d4b477541db19883a4d4a7e2dae8f9f8504f4e36cc3417e00", 'keccak512 (OO/3)');
55
56
57 is( keccak512_file('t/data/binary-test.file'), pack("H*","369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8"), 'keccak512 (raw/file/1)');
58 is( keccak512_file_hex('t/data/binary-test.file'), "369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8", 'keccak512 (hex/file/1)');
59 is( keccak512_file_b64('t/data/binary-test.file'), "Npt3nzT16yjLwE9WJOZIl6Y9xeVlLpQU+yTiUvkdTWQ1jR2DfDQ8XzOPav2IjwzMR3DKbDSoHgwPKINrfkBH+A==", 'keccak512 (base64/file/1)');
60 is( digest_file('Keccak512', 't/data/binary-test.file'), pack("H*","369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8"), 'keccak512 (digest_file_raw/file/1)');
61 is( digest_file_hex('Keccak512', 't/data/binary-test.file'), "369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8", 'keccak512 (digest_file_hex/file/1)');
62 is( digest_file_b64('Keccak512', 't/data/binary-test.file'), "Npt3nzT16yjLwE9WJOZIl6Y9xeVlLpQU+yTiUvkdTWQ1jR2DfDQ8XzOPav2IjwzMR3DKbDSoHgwPKINrfkBH+A==", 'keccak512 (digest_file_b64/file/1)');
63 is( digest_file_b64u('Keccak512', 't/data/binary-test.file'), "Npt3nzT16yjLwE9WJOZIl6Y9xeVlLpQU-yTiUvkdTWQ1jR2DfDQ8XzOPav2IjwzMR3DKbDSoHgwPKINrfkBH-A", 'keccak512 (digest_file_b64u/file/1)');
64 is( Crypt::Digest::Keccak512->new->addfile('t/data/binary-test.file')->hexdigest, "369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8", 'keccak512 (OO/file/1)');
65 {
66 open(my $fh, '<', 't/data/binary-test.file');
67 binmode($fh);
68 is( Crypt::Digest::Keccak512->new->addfile($fh)->hexdigest, "369b779f34f5eb28cbc04f5624e64897a63dc5e5652e9414fb24e252f91d4d64358d1d837c343c5f338f6afd888f0ccc4770ca6c34a81e0c0f28836b7e4047f8", 'keccak512 (OO/filehandle/1)');
69 close($fh);
70 }
71
72 is( keccak512_file('t/data/text-CR.file'), pack("H*","6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793"), 'keccak512 (raw/file/2)');
73 is( keccak512_file_hex('t/data/text-CR.file'), "6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793", 'keccak512 (hex/file/2)');
74 is( keccak512_file_b64('t/data/text-CR.file'), "bsa1r5uKNatJkQAChvhbLiU/4A9ZBK1LmZhZxhxQscjyMFD2rZf4e+vY4Oa4J3iWtRI74qP5YetZR1mVLEm3kw==", 'keccak512 (base64/file/2)');
75 is( digest_file('Keccak512', 't/data/text-CR.file'), pack("H*","6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793"), 'keccak512 (digest_file_raw/file/2)');
76 is( digest_file_hex('Keccak512', 't/data/text-CR.file'), "6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793", 'keccak512 (digest_file_hex/file/2)');
77 is( digest_file_b64('Keccak512', 't/data/text-CR.file'), "bsa1r5uKNatJkQAChvhbLiU/4A9ZBK1LmZhZxhxQscjyMFD2rZf4e+vY4Oa4J3iWtRI74qP5YetZR1mVLEm3kw==", 'keccak512 (digest_file_b64/file/2)');
78 is( digest_file_b64u('Keccak512', 't/data/text-CR.file'), "bsa1r5uKNatJkQAChvhbLiU_4A9ZBK1LmZhZxhxQscjyMFD2rZf4e-vY4Oa4J3iWtRI74qP5YetZR1mVLEm3kw", 'keccak512 (digest_file_b64u/file/2)');
79 is( Crypt::Digest::Keccak512->new->addfile('t/data/text-CR.file')->hexdigest, "6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793", 'keccak512 (OO/file/2)');
80 {
81 open(my $fh, '<', 't/data/text-CR.file');
82 binmode($fh);
83 is( Crypt::Digest::Keccak512->new->addfile($fh)->hexdigest, "6ec6b5af9b8a35ab4991000286f85b2e253fe00f5904ad4b999859c61c50b1c8f23050f6ad97f87bebd8e0e6b8277896b5123be2a3f961eb594759952c49b793", 'keccak512 (OO/filehandle/2)');
84 close($fh);
85 }
86
87 is( keccak512_file('t/data/text-CRLF.file'), pack("H*","f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf"), 'keccak512 (raw/file/3)');
88 is( keccak512_file_hex('t/data/text-CRLF.file'), "f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf", 'keccak512 (hex/file/3)');
89 is( keccak512_file_b64('t/data/text-CRLF.file'), "9oYHpqDJhFeAui45xBdI/1cYjZPdm4FAVz8KNVjdT3eo4sg0ipNuQ2APK7L98qc7uicET7UbbBF4f0U75Af7rw==", 'keccak512 (base64/file/3)');
90 is( digest_file('Keccak512', 't/data/text-CRLF.file'), pack("H*","f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf"), 'keccak512 (digest_file_raw/file/3)');
91 is( digest_file_hex('Keccak512', 't/data/text-CRLF.file'), "f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf", 'keccak512 (digest_file_hex/file/3)');
92 is( digest_file_b64('Keccak512', 't/data/text-CRLF.file'), "9oYHpqDJhFeAui45xBdI/1cYjZPdm4FAVz8KNVjdT3eo4sg0ipNuQ2APK7L98qc7uicET7UbbBF4f0U75Af7rw==", 'keccak512 (digest_file_b64/file/3)');
93 is( digest_file_b64u('Keccak512', 't/data/text-CRLF.file'), "9oYHpqDJhFeAui45xBdI_1cYjZPdm4FAVz8KNVjdT3eo4sg0ipNuQ2APK7L98qc7uicET7UbbBF4f0U75Af7rw", 'keccak512 (digest_file_b64u/file/3)');
94 is( Crypt::Digest::Keccak512->new->addfile('t/data/text-CRLF.file')->hexdigest, "f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf", 'keccak512 (OO/file/3)');
95 {
96 open(my $fh, '<', 't/data/text-CRLF.file');
97 binmode($fh);
98 is( Crypt::Digest::Keccak512->new->addfile($fh)->hexdigest, "f68607a6a0c9845780ba2e39c41748ff57188d93dd9b8140573f0a3558dd4f77a8e2c8348a936e43600f2bb2fdf2a73bba27044fb51b6c11787f453be407fbaf", 'keccak512 (OO/filehandle/3)');
99 close($fh);
100 }
101
102 is( keccak512_file('t/data/text-LF.file'), pack("H*","241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446"), 'keccak512 (raw/file/4)');
103 is( keccak512_file_hex('t/data/text-LF.file'), "241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446", 'keccak512 (hex/file/4)');
104 is( keccak512_file_b64('t/data/text-LF.file'), "JB6sQnTNdsYmP6Z5EdP3aK+3kcKA8Dx1f1wtBn6wIOUsSsk04nEs01C/y+ARFOCCTexyFA8DVbYV8SayDFfERg==", 'keccak512 (base64/file/4)');
105 is( digest_file('Keccak512', 't/data/text-LF.file'), pack("H*","241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446"), 'keccak512 (digest_file_raw/file/4)');
106 is( digest_file_hex('Keccak512', 't/data/text-LF.file'), "241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446", 'keccak512 (digest_file_hex/file/4)');
107 is( digest_file_b64('Keccak512', 't/data/text-LF.file'), "JB6sQnTNdsYmP6Z5EdP3aK+3kcKA8Dx1f1wtBn6wIOUsSsk04nEs01C/y+ARFOCCTexyFA8DVbYV8SayDFfERg==", 'keccak512 (digest_file_b64/file/4)');
108 is( digest_file_b64u('Keccak512', 't/data/text-LF.file'), "JB6sQnTNdsYmP6Z5EdP3aK-3kcKA8Dx1f1wtBn6wIOUsSsk04nEs01C_y-ARFOCCTexyFA8DVbYV8SayDFfERg", 'keccak512 (digest_file_b64u/file/4)');
109 is( Crypt::Digest::Keccak512->new->addfile('t/data/text-LF.file')->hexdigest, "241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446", 'keccak512 (OO/file/4)');
110 {
111 open(my $fh, '<', 't/data/text-LF.file');
112 binmode($fh);
113 is( Crypt::Digest::Keccak512->new->addfile($fh)->hexdigest, "241eac4274cd76c6263fa67911d3f768afb791c280f03c757f5c2d067eb020e52c4ac934e2712cd350bfcbe01114e0824dec72140f0355b615f126b20c57c446", 'keccak512 (OO/filehandle/4)');
114 close($fh);
115 }