BLAKE2
Karel Miko
6 years ago
9 | 9 | - maybe: switch yarrow > fortuna for Crypt::PK::* |
10 | 10 | - maybe: add encode_b32/decode_b32 |
11 | 11 | |
12 | 0.047_004 2017/04/24 | |
12 | 0.047_005 2017/04/25 | |
13 | 13 | - NEW: Crypt::Digest::SHA3_224 |
14 | 14 | - NEW: Crypt::Digest::SHA3_256 |
15 | 15 | - NEW: Crypt::Digest::SHA3_384 |
16 | 16 | - NEW: Crypt::Digest::SHA3_512 |
17 | 17 | - NEW: Crypt::Digest::SHAKE |
18 | - NEW: Crypt::Digest::BLAKE2b_160 | |
19 | - NEW: Crypt::Digest::BLAKE2b_256 | |
20 | - NEW: Crypt::Digest::BLAKE2b_384 | |
21 | - NEW: Crypt::Digest::BLAKE2b_512 | |
22 | - NEW: Crypt::Digest::BLAKE2s_128 | |
23 | - NEW: Crypt::Digest::BLAKE2s_160 | |
24 | - NEW: Crypt::Digest::BLAKE2s_224 | |
25 | - NEW: Crypt::Digest::BLAKE2s_256 | |
18 | 26 | - NEW: Crypt::AuthEnc::ChaCha20Poly1305 |
19 | 27 | - NEW: Crypt::Mac::Poly1305 |
28 | - NEW: Crypt::Mac::BLAKE2s | |
29 | - NEW: Crypt::Mac::BLAKE2b | |
20 | 30 | - NEW: Crypt::PRNG::ChaCha20 |
21 | 31 | - NEW: Crypt::Stream::ChaCha |
22 | 32 | - NEW: Crypt::Stream::RC4 |
100 | 100 | int id; |
101 | 101 | } *Crypt__Mac__XCBC; |
102 | 102 | |
103 | typedef struct poly1305_struct { /* used by Crypt::Mac::Poly1305 */ | |
103 | typedef struct poly1305_struct { /* used by Crypt::Mac::Poly1305 */ | |
104 | 104 | poly1305_state state; |
105 | 105 | int id; |
106 | 106 | } *Crypt__Mac__Poly1305; |
107 | ||
108 | typedef struct blake2s_struct { /* used by Crypt::Mac::BLAKE2s */ | |
109 | blake2smac_state state; | |
110 | int id; | |
111 | } *Crypt__Mac__BLAKE2s; | |
112 | ||
113 | typedef struct blake2b_struct { /* used by Crypt::Mac::BLAKE2b */ | |
114 | blake2bmac_state state; | |
115 | int id; | |
116 | } *Crypt__Mac__BLAKE2b; | |
107 | 117 | |
108 | 118 | typedef struct cbc_struct { /* used by Crypt::Mode::CBC */ |
109 | 119 | int cipher_id, cipher_rounds; |
358 | 368 | if(register_hash(&sha3_512_desc)==-1) { croak("FATAL: cannot register_hash sha3_512"); } |
359 | 369 | if(register_hash(&tiger_desc)==-1) { croak("FATAL: cannot register_hash tiger"); } |
360 | 370 | if(register_hash(&whirlpool_desc)==-1) { croak("FATAL: cannot register_hash whirlpool"); } |
371 | if(register_hash(&blake2b_160_desc)==-1) { croak("FATAL: cannot register_hash blake2b_160"); } | |
372 | if(register_hash(&blake2b_256_desc)==-1) { croak("FATAL: cannot register_hash blake2b_256"); } | |
373 | if(register_hash(&blake2b_384_desc)==-1) { croak("FATAL: cannot register_hash blake2b_384"); } | |
374 | if(register_hash(&blake2b_512_desc)==-1) { croak("FATAL: cannot register_hash blake2b_512"); } | |
375 | if(register_hash(&blake2s_128_desc)==-1) { croak("FATAL: cannot register_hash blake2s_128"); } | |
376 | if(register_hash(&blake2s_160_desc)==-1) { croak("FATAL: cannot register_hash blake2s_160"); } | |
377 | if(register_hash(&blake2s_224_desc)==-1) { croak("FATAL: cannot register_hash blake2s_224"); } | |
378 | if(register_hash(&blake2s_256_desc)==-1) { croak("FATAL: cannot register_hash blake2s_256"); } | |
361 | 379 | /* --- */ |
362 | 380 | if(chc_register(find_cipher("aes"))==-1) { croak("FATAL: chc_register failed"); } |
363 | 381 | /* --- */ |
483 | 501 | INCLUDE: inc/CryptX_Mac_PMAC.xs.inc |
484 | 502 | INCLUDE: inc/CryptX_Mac_XCBC.xs.inc |
485 | 503 | INCLUDE: inc/CryptX_Mac_Poly1305.xs.inc |
504 | INCLUDE: inc/CryptX_Mac_BLAKE2s.xs.inc | |
505 | INCLUDE: inc/CryptX_Mac_BLAKE2b.xs.inc | |
486 | 506 | |
487 | 507 | INCLUDE: inc/CryptX_Mode_CBC.xs.inc |
488 | 508 | INCLUDE: inc/CryptX_Mode_ECB.xs.inc |
38 | 38 | \.stackdump$ |
39 | 39 | ^.travis* |
40 | 40 | t/openssl/.*$ |
41 | ^src/liballinone*⏎ | |
41 | ^src/liballinone* | |
42 | ^src/update-makefiles.pl$⏎ |
19 | 19 | sub [%lc_name%]_hex { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->hexmac } |
20 | 20 | sub [%lc_name%]_b64 { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->b64mac } |
21 | 21 | sub [%lc_name%]_b64u { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->b64umac } |
22 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
23 | sub new { my $class = shift; _new(@_) } | |
24 | sub [%lc_name%] { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->mac } | |
25 | sub [%lc_name%]_hex { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->hexmac } | |
26 | sub [%lc_name%]_b64 { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->b64mac } | |
27 | sub [%lc_name%]_b64u { Crypt::Mac::[%orig_name%]->new(shift, shift)->add(@_)->b64umac } | |
22 | 28 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
23 | 29 | sub new { my $class = shift; _new(@_) } |
24 | 30 | sub [%lc_name%] { Crypt::Mac::[%orig_name%]->new(shift)->add(@_)->mac } |
54 | 60 | $[%lc_name%]_hex = [%lc_name%]_hex('SHA256', $key, 'data buffer'); |
55 | 61 | $[%lc_name%]_b64 = [%lc_name%]_b64('SHA256', $key, 'data buffer'); |
56 | 62 | $[%lc_name%]_b64u = [%lc_name%]_b64u('SHA256', $key, 'data buffer'); |
63 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
64 | $[%lc_name%]_raw = [%lc_name%]($size, $key, 'data buffer'); | |
65 | $[%lc_name%]_hex = [%lc_name%]_hex($size, $key, 'data buffer'); | |
66 | $[%lc_name%]_b64 = [%lc_name%]_b64($size, $key, 'data buffer'); | |
67 | $[%lc_name%]_b64u = [%lc_name%]_b64u($size, $key, 'data buffer'); | |
57 | 68 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
58 | 69 | $[%lc_name%]_raw = [%lc_name%]($key, 'data buffer'); |
59 | 70 | $[%lc_name%]_hex = [%lc_name%]_hex($key, 'data buffer'); |
71 | 82 | |
72 | 83 | [%-IF lc_name == 'hmac' %] |
73 | 84 | $d = Crypt::Mac::[%orig_name%]->new('SHA256', $key); |
85 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
86 | $d = Crypt::Mac::[%orig_name%]->new($size, $key); | |
74 | 87 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
75 | 88 | $d = Crypt::Mac::[%orig_name%]->new($key); |
76 | 89 | [%-ELSE%] |
110 | 123 | $[%lc_name%]_raw = [%lc_name%]($hash_name, $key, 'data buffer'); |
111 | 124 | #or |
112 | 125 | $[%lc_name%]_raw = [%lc_name%]($hash_name, $key, 'any data', 'more data', 'even more data'); |
126 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
127 | $[%lc_name%]_raw = [%lc_name%]($size, $key, 'data buffer'); | |
128 | #or | |
129 | $[%lc_name%]_raw = [%lc_name%]($size, $key, 'any data', 'more data', 'even more data'); | |
113 | 130 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
114 | 131 | $[%lc_name%]_raw = [%lc_name%]($key, 'data buffer'); |
115 | 132 | #or |
128 | 145 | $[%lc_name%]_hex = [%lc_name%]_hex($hash_name, $key, 'data buffer'); |
129 | 146 | #or |
130 | 147 | $[%lc_name%]_hex = [%lc_name%]_hex($hash_name, $key, 'any data', 'more data', 'even more data'); |
148 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
149 | $[%lc_name%]_hex = [%lc_name%]_hex($size, $key, 'data buffer'); | |
150 | #or | |
151 | $[%lc_name%]_hex = [%lc_name%]_hex($size, $key, 'any data', 'more data', 'even more data'); | |
131 | 152 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
132 | 153 | $[%lc_name%]_hex = [%lc_name%]_hex($key, 'data buffer'); |
133 | 154 | #or |
146 | 167 | $[%lc_name%]_b64 = [%lc_name%]_b64($hash_name, $key, 'data buffer'); |
147 | 168 | #or |
148 | 169 | $[%lc_name%]_b64 = [%lc_name%]_b64($hash_name, $key, 'any data', 'more data', 'even more data'); |
170 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
171 | $[%lc_name%]_b64 = [%lc_name%]_b64($size, $key, 'data buffer'); | |
172 | #or | |
173 | $[%lc_name%]_b64 = [%lc_name%]_b64($size, $key, 'any data', 'more data', 'even more data'); | |
149 | 174 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
150 | 175 | $[%lc_name%]_b64 = [%lc_name%]_b64($key, 'data buffer'); |
151 | 176 | #or |
164 | 189 | $[%lc_name%]_b64url = [%lc_name%]_b64u($hash_name, $key, 'data buffer'); |
165 | 190 | #or |
166 | 191 | $[%lc_name%]_b64url = [%lc_name%]_b64u($hash_name, $key, 'any data', 'more data', 'even more data'); |
192 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
193 | $[%lc_name%]_b64url = [%lc_name%]_b64u($size, $key, 'data buffer'); | |
194 | #or | |
195 | $[%lc_name%]_b64url = [%lc_name%]_b64u($size, $key, 'any data', 'more data', 'even more data'); | |
167 | 196 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
168 | 197 | $[%lc_name%]_b64url = [%lc_name%]_b64u($key, 'data buffer'); |
169 | 198 | #or |
180 | 209 | |
181 | 210 | [%-IF lc_name == 'hmac' %] |
182 | 211 | $d = Crypt::Mac::[%orig_name%]->new($hash_name, $key); |
212 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
213 | $d = Crypt::Mac::[%orig_name%]->new($size, $key); | |
183 | 214 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
184 | 215 | $d = Crypt::Mac::[%orig_name%]->new($key); |
185 | 216 | [%-ELSE%] |
4 | 4 | Crypt::Mac::[%orig_name%] |
5 | 5 | [%-IF lc_name == 'hmac' %] |
6 | 6 | _new(char * hash_name, SV * key) |
7 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
8 | _new(int size, SV * key) | |
7 | 9 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
8 | 10 | _new(SV * key) |
9 | 11 | [%-ELSE%] |
19 | 21 | |
20 | 22 | id = find_hash(hash_name); |
21 | 23 | if(id==-1) croak("FATAL: find_hash failed for '%s'", hash_name); |
24 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
22 | 25 | [%-ELSIF lc_name == 'pelican' || lc_name == 'poly1305' %] |
23 | 26 | [%-ELSE%] |
24 | 27 | int id; |
35 | 38 | |
36 | 39 | [%-IF lc_name == 'pelican' || lc_name == 'poly1305' %] |
37 | 40 | rv = [%lc_name%]_init(&RETVAL->state, k, (unsigned long)k_len); |
41 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
42 | rv = [%lc_name%]mac_init(&RETVAL->state, size, k, (unsigned long)k_len); | |
38 | 43 | [%-ELSE%] |
39 | 44 | rv = [%lc_name%]_init(&RETVAL->state, id, k, (unsigned long)k_len); |
40 | 45 | [%-END%] |
67 | 72 | |
68 | 73 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); |
69 | 74 | if (in_data_len>0) { |
75 | [%-IF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
76 | rv = [%lc_name%]mac_process(&self->state, in_data, (unsigned long)in_data_len); | |
77 | [%-ELSE%] | |
70 | 78 | rv = [%lc_name%]_process(&self->state, in_data, (unsigned long)in_data_len); |
79 | [%-END%] | |
71 | 80 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_process failed: %s", error_to_string(rv)); |
72 | 81 | } |
73 | 82 | } |
84 | 93 | mac_len = 16; |
85 | 94 | rv = [%lc_name%]_done(&self->state, (unsigned char*)mac); |
86 | 95 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_done failed: %s", error_to_string(rv)); |
96 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
97 | mac_len = sizeof(mac); | |
98 | rv = [%lc_name%]mac_done(&self->state, (unsigned char*)mac, &mac_len); | |
99 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]mac_done failed: %s", error_to_string(rv)); | |
87 | 100 | [%-ELSE%] |
88 | 101 | mac_len = sizeof(mac); |
89 | 102 | rv = [%lc_name%]_done(&self->state, (unsigned char*)mac, &mac_len); |
108 | 121 | mac_len = 16; |
109 | 122 | rv = [%lc_name%]_done(&self->state, mac); |
110 | 123 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_done failed: %s", error_to_string(rv)); |
124 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
125 | mac_len = sizeof(mac); | |
126 | rv = [%lc_name%]mac_done(&self->state, mac, &mac_len); | |
127 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]mac_done failed: %s", error_to_string(rv)); | |
111 | 128 | [%-ELSE%] |
112 | 129 | mac_len = sizeof(mac); |
113 | 130 | rv = [%lc_name%]_done(&self->state, mac, &mac_len); |
135 | 152 | mac_len = 16; |
136 | 153 | rv = [%lc_name%]_done(&self->state, mac); |
137 | 154 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_done failed: %s", error_to_string(rv)); |
155 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
156 | mac_len = sizeof(mac); | |
157 | rv = [%lc_name%]mac_done(&self->state, mac, &mac_len); | |
158 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]mac_done failed: %s", error_to_string(rv)); | |
138 | 159 | [%-ELSE%] |
139 | 160 | mac_len = sizeof(mac); |
140 | 161 | rv = [%lc_name%]_done(&self->state, mac, &mac_len); |
161 | 182 | mac_len = 16; |
162 | 183 | rv = [%lc_name%]_done(&self->state, mac); |
163 | 184 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_done failed: %s", error_to_string(rv)); |
185 | [%-ELSIF lc_name == 'blake2s' || lc_name == 'blake2b' %] | |
186 | mac_len = sizeof(mac); | |
187 | rv = [%lc_name%]mac_done(&self->state, mac, &mac_len); | |
188 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]mac_done failed: %s", error_to_string(rv)); | |
164 | 189 | [%-ELSE%] |
165 | 190 | mac_len = sizeof(mac); |
166 | 191 | rv = [%lc_name%]_done(&self->state, mac, &mac_len); |
22 | 22 | warn "STARTED: outdir_l='$outdir_l' outdir_t='$outdir_t'\n"; |
23 | 23 | |
24 | 24 | my %list = ( |
25 | CHAES => { ltc=>'chc_hash', info=>'Hash function - CipherHash based on AES [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers'] }, | |
26 | MD2 => { ltc=>'md2', info=>'Hash function MD2 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD2_(cryptography)'] }, | |
27 | MD4 => { ltc=>'md4', info=>'Hash function MD4 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD4'] }, | |
28 | MD5 => { ltc=>'md5', info=>'Hash function MD5 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD5'] }, | |
29 | RIPEMD128 => { ltc=>'rmd128', info=>'Hash function RIPEMD-128 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
30 | RIPEMD160 => { ltc=>'rmd160', info=>'Hash function RIPEMD-160 [size: 160 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
31 | RIPEMD256 => { ltc=>'rmd256', info=>'Hash function RIPEMD-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
32 | RIPEMD320 => { ltc=>'rmd320', info=>'Hash function RIPEMD-320 [size: 320 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
33 | SHA1 => { ltc=>'sha1', info=>'Hash function SHA-1 [size: 160 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-1'] }, | |
34 | SHA224 => { ltc=>'sha224', info=>'Hash function SHA-224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
35 | SHA256 => { ltc=>'sha256', info=>'Hash function SHA-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
36 | SHA384 => { ltc=>'sha384', info=>'Hash function SHA-384 [size: 384 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
37 | SHA512 => { ltc=>'sha512', info=>'Hash function SHA-512 [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
38 | SHA512_224 => { ltc=>'sha512_224',info=>'Hash function SHA-512/224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
39 | SHA512_256 => { ltc=>'sha512_256',info=>'Hash function SHA-512/256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
40 | SHA3_224 => { ltc=>'sha3_224', info=>'Hash function SHA3-224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
41 | SHA3_256 => { ltc=>'sha3_256', info=>'Hash function SHA3-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
42 | SHA3_384 => { ltc=>'sha3_384', info=>'Hash function SHA3-384 [size: 384 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
43 | SHA3_512 => { ltc=>'sha3_512', info=>'Hash function SHA3-512 [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
44 | Tiger192 => { ltc=>'tiger', info=>'Hash function Tiger-192 [size: 192 bits]', urls=>['http://en.wikipedia.org/wiki/Tiger_(cryptography)'] }, | |
45 | Whirlpool => { ltc=>'whirlpool', info=>'Hash function Whirlpool [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/Whirlpool_(cryptography)'] }, | |
25 | CHAES => { ltc=>'chc_hash', info=>'Hash function - CipherHash based on AES [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers'] }, | |
26 | MD2 => { ltc=>'md2', info=>'Hash function MD2 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD2_(cryptography)'] }, | |
27 | MD4 => { ltc=>'md4', info=>'Hash function MD4 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD4'] }, | |
28 | MD5 => { ltc=>'md5', info=>'Hash function MD5 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/MD5'] }, | |
29 | RIPEMD128 => { ltc=>'rmd128', info=>'Hash function RIPEMD-128 [size: 128 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
30 | RIPEMD160 => { ltc=>'rmd160', info=>'Hash function RIPEMD-160 [size: 160 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
31 | RIPEMD256 => { ltc=>'rmd256', info=>'Hash function RIPEMD-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
32 | RIPEMD320 => { ltc=>'rmd320', info=>'Hash function RIPEMD-320 [size: 320 bits]', urls=>['http://en.wikipedia.org/wiki/RIPEMD'] }, | |
33 | SHA1 => { ltc=>'sha1', info=>'Hash function SHA-1 [size: 160 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-1'] }, | |
34 | SHA224 => { ltc=>'sha224', info=>'Hash function SHA-224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
35 | SHA256 => { ltc=>'sha256', info=>'Hash function SHA-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
36 | SHA384 => { ltc=>'sha384', info=>'Hash function SHA-384 [size: 384 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
37 | SHA512 => { ltc=>'sha512', info=>'Hash function SHA-512 [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
38 | SHA512_224 => { ltc=>'sha512_224', info=>'Hash function SHA-512/224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
39 | SHA512_256 => { ltc=>'sha512_256', info=>'Hash function SHA-512/256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-2'] }, | |
40 | SHA3_224 => { ltc=>'sha3-224', info=>'Hash function SHA3-224 [size: 224 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
41 | SHA3_256 => { ltc=>'sha3-256', info=>'Hash function SHA3-256 [size: 256 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
42 | SHA3_384 => { ltc=>'sha3-384', info=>'Hash function SHA3-384 [size: 384 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
43 | SHA3_512 => { ltc=>'sha3-512', info=>'Hash function SHA3-512 [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/SHA-3'] }, | |
44 | Tiger192 => { ltc=>'tiger', info=>'Hash function Tiger-192 [size: 192 bits]', urls=>['http://en.wikipedia.org/wiki/Tiger_(cryptography)'] }, | |
45 | Whirlpool => { ltc=>'whirlpool', info=>'Hash function Whirlpool [size: 512 bits]', urls=>['http://en.wikipedia.org/wiki/Whirlpool_(cryptography)'] }, | |
46 | BLAKE2b_160 => { ltc=>'blake2b-160', info=>'Hash function BLAKE2b [size: 160 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
47 | BLAKE2b_256 => { ltc=>'blake2b-256', info=>'Hash function BLAKE2b [size: 256 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
48 | BLAKE2b_384 => { ltc=>'blake2b-384', info=>'Hash function BLAKE2b [size: 384 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
49 | BLAKE2b_512 => { ltc=>'blake2b-512', info=>'Hash function BLAKE2b [size: 512 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
50 | BLAKE2s_128 => { ltc=>'blake2s-128', info=>'Hash function BLAKE2s [size: 128 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
51 | BLAKE2s_160 => { ltc=>'blake2s-160', info=>'Hash function BLAKE2s [size: 160 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
52 | BLAKE2s_224 => { ltc=>'blake2s-224', info=>'Hash function BLAKE2s [size: 224 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
53 | BLAKE2s_256 => { ltc=>'blake2s-256', info=>'Hash function BLAKE2s [size: 256 bits]', urls=>['https://blake2.net/', 'https://tools.ietf.org/html/rfc7693'] }, | |
46 | 54 | ); |
47 | 55 | |
48 | 56 | my @test_strings = ( '', '123', "test\0test\0test\n"); |
28 | 28 | PMAC => { info=>'Message authentication code PMAC', urls=>['https://en.wikipedia.org/wiki/PMAC_%28cryptography%29'] }, |
29 | 29 | XCBC => { info=>'Message authentication code XCBC (RFC 3566)', urls=>['https://www.ietf.org/rfc/rfc3566.txt'] }, |
30 | 30 | Poly1305=> { info=>'Message authentication code Poly1305 (RFC 7539)', urls=>['https://www.ietf.org/rfc/rfc7539.txt'] }, |
31 | BLAKE2s => { info=>'Message authentication code BLAKE2s MAC (RFC 7693)', urls=>['https://tools.ietf.org/html/rfc7693'] }, | |
32 | BLAKE2b => { info=>'Message authentication code BLAKE2b MAC (RFC 7693)', urls=>['https://tools.ietf.org/html/rfc7693'] }, | |
31 | 33 | ); |
32 | 34 | |
33 | 35 | my @test_strings = ( '', '123', "test\0test\0test\n"); |
55 | 57 | require Crypt::Mac::PMAC; |
56 | 58 | require Crypt::Mac::XCBC; |
57 | 59 | require Crypt::Mac::Poly1305; |
60 | require Crypt::Mac::BLAKE2s; | |
61 | require Crypt::Mac::BLAKE2b; | |
58 | 62 | |
59 | 63 | for (@test_strings) { |
60 | 64 | if ($n eq 'HMAC') { |
72 | 76 | elsif ($n eq 'Poly1305') { |
73 | 77 | push @{$data->{t_strings}}, { mac=>unpack('H*', Crypt::Mac::Poly1305->new('12345678901234561234567890123456')->add($_)->mac), data=>pp($_), args=>"'12345678901234561234567890123456'" }; |
74 | 78 | push @{$data->{t_strings}}, { mac=>unpack('H*', Crypt::Mac::Poly1305->new('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add($_)->mac), data=>pp($_), args=>"'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'" }; |
79 | } | |
80 | elsif ($n =~ /BLAKE2(s|b)/) { | |
81 | push @{$data->{t_strings}}, { mac=>unpack('H*', "Crypt::Mac::$n"->new(32, '12345678901234561234567890123456')->add($_)->mac), data=>pp($_), args=>"32,'12345678901234561234567890123456'" }; | |
82 | push @{$data->{t_strings}}, { mac=>unpack('H*', "Crypt::Mac::$n"->new(32, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add($_)->mac), data=>pp($_), args=>"32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'" }; | |
75 | 83 | } |
76 | 84 | else { |
77 | 85 | push @{$data->{t_strings}}, { mac=>unpack('H*', "Crypt::Mac::$n"->new('AES', '1234567890123456')->add($_)->mac), data=>pp($_), args=>"'AES','1234567890123456'" }; |
45 | 45 | int rv; |
46 | 46 | rv = chacha20poly1305_inciv(&self->state); |
47 | 47 | if (rv != CRYPT_OK) croak("FATAL: chacha20poly1305_inciv failed: %s", error_to_string(rv)); |
48 | RETVAL = rv; | |
49 | } | |
50 | OUTPUT: | |
51 | RETVAL | |
52 | ||
53 | int | |
54 | set_iv(Crypt::AuthEnc::ChaCha20Poly1305 self, SV * nonce) | |
55 | CODE: | |
56 | { | |
57 | int rv; | |
58 | STRLEN iv_len=0; | |
59 | unsigned char *iv=NULL; | |
60 | ||
61 | if (!SvPOK(nonce)) croak("FATAL: nonce must be string/buffer scalar"); | |
62 | iv = (unsigned char *) SvPVbyte(nonce, iv_len); | |
63 | rv = chacha20poly1305_setiv(&self->state, iv, (unsigned long)iv_len); | |
64 | if (rv != CRYPT_OK) croak("FATAL: chacha20poly1305_setiv failed: %s", error_to_string(rv)); | |
65 | RETVAL = rv; | |
66 | } | |
67 | OUTPUT: | |
68 | RETVAL | |
69 | ||
70 | int | |
71 | set_iv_rfc7905(Crypt::AuthEnc::ChaCha20Poly1305 self, SV * nonce, UV seqnum) | |
72 | CODE: | |
73 | { | |
74 | int rv; | |
75 | STRLEN iv_len=0; | |
76 | unsigned char *iv=NULL; | |
77 | ||
78 | if (!SvPOK(nonce)) croak("FATAL: nonce must be string/buffer scalar"); | |
79 | iv = (unsigned char *) SvPVbyte(nonce, iv_len); | |
80 | rv = chacha20poly1305_setiv_rfc7905(&self->state, iv, (unsigned long)iv_len, (ulong64)seqnum); | |
81 | if (rv != CRYPT_OK) croak("FATAL: chacha20poly1305_setiv_rfc7905 failed: %s", error_to_string(rv)); | |
48 | 82 | RETVAL = rv; |
49 | 83 | } |
50 | 84 | OUTPUT: |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::BLAKE2b | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::BLAKE2b | |
5 | _new(int size, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | ||
12 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
13 | k = (unsigned char *) SvPVbyte(key, k_len); | |
14 | ||
15 | Newz(0, RETVAL, 1, struct blake2b_struct); | |
16 | if (!RETVAL) croak("FATAL: Newz failed"); | |
17 | ||
18 | rv = blake2bmac_init(&RETVAL->state, size, k, (unsigned long)k_len); | |
19 | if (rv != CRYPT_OK) croak("FATAL: blake2b_init failed: %s", error_to_string(rv)); | |
20 | } | |
21 | OUTPUT: | |
22 | RETVAL | |
23 | ||
24 | void | |
25 | DESTROY(Crypt::Mac::BLAKE2b self) | |
26 | CODE: | |
27 | Safefree(self); | |
28 | ||
29 | Crypt::Mac::BLAKE2b | |
30 | clone(Crypt::Mac::BLAKE2b self) | |
31 | CODE: | |
32 | Newz(0, RETVAL, 1, struct blake2b_struct); | |
33 | if (!RETVAL) croak("FATAL: Newz failed"); | |
34 | Copy(&self->state, &RETVAL->state, 1, struct blake2b_struct); | |
35 | OUTPUT: | |
36 | RETVAL | |
37 | ||
38 | void | |
39 | _add_single(Crypt::Mac::BLAKE2b self, SV * data) | |
40 | CODE: | |
41 | { | |
42 | int rv; | |
43 | STRLEN in_data_len; | |
44 | unsigned char *in_data; | |
45 | ||
46 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
47 | if (in_data_len>0) { | |
48 | rv = blake2bmac_process(&self->state, in_data, (unsigned long)in_data_len); | |
49 | if (rv != CRYPT_OK) croak("FATAL: blake2b_process failed: %s", error_to_string(rv)); | |
50 | } | |
51 | } | |
52 | ||
53 | SV * | |
54 | mac(Crypt::Mac::BLAKE2b self) | |
55 | CODE: | |
56 | { | |
57 | char mac[MAXBLOCKSIZE]; | |
58 | unsigned long mac_len; | |
59 | int rv; | |
60 | ||
61 | mac_len = sizeof(mac); | |
62 | rv = blake2bmac_done(&self->state, (unsigned char*)mac, &mac_len); | |
63 | if (rv != CRYPT_OK) croak("FATAL: blake2bmac_done failed: %s", error_to_string(rv)); | |
64 | RETVAL = newSVpvn(mac, mac_len); | |
65 | } | |
66 | OUTPUT: | |
67 | RETVAL | |
68 | ||
69 | SV * | |
70 | b64mac(Crypt::Mac::BLAKE2b self) | |
71 | CODE: | |
72 | { | |
73 | unsigned char mac[MAXBLOCKSIZE]; | |
74 | unsigned long mac_len; | |
75 | int rv; | |
76 | unsigned long outlen; | |
77 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
78 | ||
79 | mac_len = sizeof(mac); | |
80 | rv = blake2bmac_done(&self->state, mac, &mac_len); | |
81 | if (rv != CRYPT_OK) croak("FATAL: blake2bmac_done failed: %s", error_to_string(rv)); | |
82 | outlen = sizeof(mac_base64); | |
83 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
84 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
85 | RETVAL = newSVpvn(mac_base64, outlen); | |
86 | } | |
87 | OUTPUT: | |
88 | RETVAL | |
89 | ||
90 | SV * | |
91 | b64umac(Crypt::Mac::BLAKE2b self) | |
92 | CODE: | |
93 | { | |
94 | unsigned char mac[MAXBLOCKSIZE]; | |
95 | unsigned long mac_len; | |
96 | int rv; | |
97 | unsigned long outlen; | |
98 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
99 | ||
100 | mac_len = sizeof(mac); | |
101 | rv = blake2bmac_done(&self->state, mac, &mac_len); | |
102 | if (rv != CRYPT_OK) croak("FATAL: blake2bmac_done failed: %s", error_to_string(rv)); | |
103 | outlen = sizeof(mac_base64); | |
104 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
105 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
106 | RETVAL = newSVpvn(mac_base64, outlen); | |
107 | } | |
108 | OUTPUT: | |
109 | RETVAL | |
110 | ||
111 | SV * | |
112 | hexmac(Crypt::Mac::BLAKE2b self) | |
113 | CODE: | |
114 | { | |
115 | unsigned char mac[MAXBLOCKSIZE]; | |
116 | unsigned long mac_len, i; | |
117 | int rv; | |
118 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
119 | ||
120 | mac_len = sizeof(mac); | |
121 | rv = blake2bmac_done(&self->state, mac, &mac_len); | |
122 | if (rv != CRYPT_OK) croak("FATAL: blake2bmac_done failed: %s", error_to_string(rv)); | |
123 | mac_hex[0] = '\0'; | |
124 | for(i=0; i<mac_len; i++) | |
125 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
126 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
127 | } | |
128 | OUTPUT: | |
129 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::BLAKE2s | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::BLAKE2s | |
5 | _new(int size, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | ||
12 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
13 | k = (unsigned char *) SvPVbyte(key, k_len); | |
14 | ||
15 | Newz(0, RETVAL, 1, struct blake2s_struct); | |
16 | if (!RETVAL) croak("FATAL: Newz failed"); | |
17 | ||
18 | rv = blake2smac_init(&RETVAL->state, size, k, (unsigned long)k_len); | |
19 | if (rv != CRYPT_OK) croak("FATAL: blake2s_init failed: %s", error_to_string(rv)); | |
20 | } | |
21 | OUTPUT: | |
22 | RETVAL | |
23 | ||
24 | void | |
25 | DESTROY(Crypt::Mac::BLAKE2s self) | |
26 | CODE: | |
27 | Safefree(self); | |
28 | ||
29 | Crypt::Mac::BLAKE2s | |
30 | clone(Crypt::Mac::BLAKE2s self) | |
31 | CODE: | |
32 | Newz(0, RETVAL, 1, struct blake2s_struct); | |
33 | if (!RETVAL) croak("FATAL: Newz failed"); | |
34 | Copy(&self->state, &RETVAL->state, 1, struct blake2s_struct); | |
35 | OUTPUT: | |
36 | RETVAL | |
37 | ||
38 | void | |
39 | _add_single(Crypt::Mac::BLAKE2s self, SV * data) | |
40 | CODE: | |
41 | { | |
42 | int rv; | |
43 | STRLEN in_data_len; | |
44 | unsigned char *in_data; | |
45 | ||
46 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
47 | if (in_data_len>0) { | |
48 | rv = blake2smac_process(&self->state, in_data, (unsigned long)in_data_len); | |
49 | if (rv != CRYPT_OK) croak("FATAL: blake2s_process failed: %s", error_to_string(rv)); | |
50 | } | |
51 | } | |
52 | ||
53 | SV * | |
54 | mac(Crypt::Mac::BLAKE2s self) | |
55 | CODE: | |
56 | { | |
57 | char mac[MAXBLOCKSIZE]; | |
58 | unsigned long mac_len; | |
59 | int rv; | |
60 | ||
61 | mac_len = sizeof(mac); | |
62 | rv = blake2smac_done(&self->state, (unsigned char*)mac, &mac_len); | |
63 | if (rv != CRYPT_OK) croak("FATAL: blake2smac_done failed: %s", error_to_string(rv)); | |
64 | RETVAL = newSVpvn(mac, mac_len); | |
65 | } | |
66 | OUTPUT: | |
67 | RETVAL | |
68 | ||
69 | SV * | |
70 | b64mac(Crypt::Mac::BLAKE2s self) | |
71 | CODE: | |
72 | { | |
73 | unsigned char mac[MAXBLOCKSIZE]; | |
74 | unsigned long mac_len; | |
75 | int rv; | |
76 | unsigned long outlen; | |
77 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
78 | ||
79 | mac_len = sizeof(mac); | |
80 | rv = blake2smac_done(&self->state, mac, &mac_len); | |
81 | if (rv != CRYPT_OK) croak("FATAL: blake2smac_done failed: %s", error_to_string(rv)); | |
82 | outlen = sizeof(mac_base64); | |
83 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
84 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
85 | RETVAL = newSVpvn(mac_base64, outlen); | |
86 | } | |
87 | OUTPUT: | |
88 | RETVAL | |
89 | ||
90 | SV * | |
91 | b64umac(Crypt::Mac::BLAKE2s self) | |
92 | CODE: | |
93 | { | |
94 | unsigned char mac[MAXBLOCKSIZE]; | |
95 | unsigned long mac_len; | |
96 | int rv; | |
97 | unsigned long outlen; | |
98 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
99 | ||
100 | mac_len = sizeof(mac); | |
101 | rv = blake2smac_done(&self->state, mac, &mac_len); | |
102 | if (rv != CRYPT_OK) croak("FATAL: blake2smac_done failed: %s", error_to_string(rv)); | |
103 | outlen = sizeof(mac_base64); | |
104 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
105 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
106 | RETVAL = newSVpvn(mac_base64, outlen); | |
107 | } | |
108 | OUTPUT: | |
109 | RETVAL | |
110 | ||
111 | SV * | |
112 | hexmac(Crypt::Mac::BLAKE2s self) | |
113 | CODE: | |
114 | { | |
115 | unsigned char mac[MAXBLOCKSIZE]; | |
116 | unsigned long mac_len, i; | |
117 | int rv; | |
118 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
119 | ||
120 | mac_len = sizeof(mac); | |
121 | rv = blake2smac_done(&self->state, mac, &mac_len); | |
122 | if (rv != CRYPT_OK) croak("FATAL: blake2smac_done failed: %s", error_to_string(rv)); | |
123 | mac_hex[0] = '\0'; | |
124 | for(i=0; i<mac_len; i++) | |
125 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
126 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
127 | } | |
128 | OUTPUT: | |
129 | RETVAL |
146 | 146 | |
147 | 147 | =head2 increment_iv |
148 | 148 | |
149 | $ae->increment_iv; | |
149 | $ae->increment_iv(); | |
150 | ||
151 | =head2 set_iv | |
152 | ||
153 | $ae->set_iv($iv); | |
154 | ||
155 | =head2 set_iv_rfc7905 | |
156 | ||
157 | $ae->set_iv_rfc7905($iv, $seqnum); | |
150 | 158 | |
151 | 159 | =head1 SEE ALSO |
152 | 160 |
0 | package Crypt::Digest::BLAKE2b_160; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2b_160 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2b_160_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2b_160_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2b_160_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2b_160_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2b_160_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2b_160_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2b_160_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2b_160 - Hash function BLAKE2b [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2b_160 qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u | |
41 | blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2b_160_raw = blake2b_160('data string'); | |
45 | $blake2b_160_hex = blake2b_160_hex('data string'); | |
46 | $blake2b_160_b64 = blake2b_160_b64('data string'); | |
47 | $blake2b_160_b64u = blake2b_160_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2b_160_raw = blake2b_160_file('filename.dat'); | |
50 | $blake2b_160_hex = blake2b_160_file_hex('filename.dat'); | |
51 | $blake2b_160_b64 = blake2b_160_file_b64('filename.dat'); | |
52 | $blake2b_160_b64u = blake2b_160_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2b_160_raw = blake2b_160_file(*FILEHANDLE); | |
55 | $blake2b_160_hex = blake2b_160_file_hex(*FILEHANDLE); | |
56 | $blake2b_160_b64 = blake2b_160_file_b64(*FILEHANDLE); | |
57 | $blake2b_160_b64u = blake2b_160_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2b_160; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2b_160->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2b_160 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2b_160 qw(blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u | |
82 | blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2b_160 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2b_160 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2b_160 digest encoded as a binary string. | |
93 | ||
94 | $blake2b_160_raw = blake2b_160('data string'); | |
95 | #or | |
96 | $blake2b_160_raw = blake2b_160('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2b_160_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2b_160 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2b_160_hex = blake2b_160_hex('data string'); | |
103 | #or | |
104 | $blake2b_160_hex = blake2b_160_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2b_160_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2b_160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2b_160_b64 = blake2b_160_b64('data string'); | |
111 | #or | |
112 | $blake2b_160_b64 = blake2b_160_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2b_160_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2b_160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2b_160_b64url = blake2b_160_b64u('data string'); | |
119 | #or | |
120 | $blake2b_160_b64url = blake2b_160_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2b_160_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_160 digest encoded as a binary string. | |
125 | ||
126 | $blake2b_160_raw = blake2b_160_file('filename.dat'); | |
127 | #or | |
128 | $blake2b_160_raw = blake2b_160_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2b_160_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_160 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2b_160_hex = blake2b_160_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2b_160_hex = blake2b_160_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2b_160_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2b_160_b64 = blake2b_160_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2b_160_b64 = blake2b_160_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2b_160_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2b_160_b64url = blake2b_160_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2b_160_b64url = blake2b_160_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2b_160->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2b_160->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2b_160::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2b_256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2b_256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2b_256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2b_256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2b_256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2b_256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2b_256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2b_256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2b_256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2b_256 - Hash function BLAKE2b [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2b_256 qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u | |
41 | blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2b_256_raw = blake2b_256('data string'); | |
45 | $blake2b_256_hex = blake2b_256_hex('data string'); | |
46 | $blake2b_256_b64 = blake2b_256_b64('data string'); | |
47 | $blake2b_256_b64u = blake2b_256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2b_256_raw = blake2b_256_file('filename.dat'); | |
50 | $blake2b_256_hex = blake2b_256_file_hex('filename.dat'); | |
51 | $blake2b_256_b64 = blake2b_256_file_b64('filename.dat'); | |
52 | $blake2b_256_b64u = blake2b_256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2b_256_raw = blake2b_256_file(*FILEHANDLE); | |
55 | $blake2b_256_hex = blake2b_256_file_hex(*FILEHANDLE); | |
56 | $blake2b_256_b64 = blake2b_256_file_b64(*FILEHANDLE); | |
57 | $blake2b_256_b64u = blake2b_256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2b_256; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2b_256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2b_256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2b_256 qw(blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u | |
82 | blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2b_256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2b_256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2b_256 digest encoded as a binary string. | |
93 | ||
94 | $blake2b_256_raw = blake2b_256('data string'); | |
95 | #or | |
96 | $blake2b_256_raw = blake2b_256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2b_256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2b_256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2b_256_hex = blake2b_256_hex('data string'); | |
103 | #or | |
104 | $blake2b_256_hex = blake2b_256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2b_256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2b_256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2b_256_b64 = blake2b_256_b64('data string'); | |
111 | #or | |
112 | $blake2b_256_b64 = blake2b_256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2b_256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2b_256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2b_256_b64url = blake2b_256_b64u('data string'); | |
119 | #or | |
120 | $blake2b_256_b64url = blake2b_256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2b_256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_256 digest encoded as a binary string. | |
125 | ||
126 | $blake2b_256_raw = blake2b_256_file('filename.dat'); | |
127 | #or | |
128 | $blake2b_256_raw = blake2b_256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2b_256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2b_256_hex = blake2b_256_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2b_256_hex = blake2b_256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2b_256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2b_256_b64 = blake2b_256_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2b_256_b64 = blake2b_256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2b_256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2b_256_b64url = blake2b_256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2b_256_b64url = blake2b_256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2b_256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2b_256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2b_256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2b_384; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2b_384 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2b_384_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2b_384_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2b_384_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2b_384_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2b_384_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2b_384_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2b_384_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2b_384 - Hash function BLAKE2b [size: 384 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2b_384 qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u | |
41 | blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2b_384_raw = blake2b_384('data string'); | |
45 | $blake2b_384_hex = blake2b_384_hex('data string'); | |
46 | $blake2b_384_b64 = blake2b_384_b64('data string'); | |
47 | $blake2b_384_b64u = blake2b_384_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2b_384_raw = blake2b_384_file('filename.dat'); | |
50 | $blake2b_384_hex = blake2b_384_file_hex('filename.dat'); | |
51 | $blake2b_384_b64 = blake2b_384_file_b64('filename.dat'); | |
52 | $blake2b_384_b64u = blake2b_384_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2b_384_raw = blake2b_384_file(*FILEHANDLE); | |
55 | $blake2b_384_hex = blake2b_384_file_hex(*FILEHANDLE); | |
56 | $blake2b_384_b64 = blake2b_384_file_b64(*FILEHANDLE); | |
57 | $blake2b_384_b64u = blake2b_384_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2b_384; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2b_384->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2b_384 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2b_384 qw(blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u | |
82 | blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2b_384 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2b_384 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2b_384 digest encoded as a binary string. | |
93 | ||
94 | $blake2b_384_raw = blake2b_384('data string'); | |
95 | #or | |
96 | $blake2b_384_raw = blake2b_384('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2b_384_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2b_384 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2b_384_hex = blake2b_384_hex('data string'); | |
103 | #or | |
104 | $blake2b_384_hex = blake2b_384_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2b_384_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2b_384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2b_384_b64 = blake2b_384_b64('data string'); | |
111 | #or | |
112 | $blake2b_384_b64 = blake2b_384_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2b_384_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2b_384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2b_384_b64url = blake2b_384_b64u('data string'); | |
119 | #or | |
120 | $blake2b_384_b64url = blake2b_384_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2b_384_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_384 digest encoded as a binary string. | |
125 | ||
126 | $blake2b_384_raw = blake2b_384_file('filename.dat'); | |
127 | #or | |
128 | $blake2b_384_raw = blake2b_384_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2b_384_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_384 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2b_384_hex = blake2b_384_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2b_384_hex = blake2b_384_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2b_384_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2b_384_b64 = blake2b_384_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2b_384_b64 = blake2b_384_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2b_384_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2b_384_b64url = blake2b_384_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2b_384_b64url = blake2b_384_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2b_384->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2b_384->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2b_384::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2b_512; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2b_512 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2b_512_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2b_512_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2b_512_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2b_512_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2b_512_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2b_512_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2b_512_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2b_512 - Hash function BLAKE2b [size: 512 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2b_512 qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u | |
41 | blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2b_512_raw = blake2b_512('data string'); | |
45 | $blake2b_512_hex = blake2b_512_hex('data string'); | |
46 | $blake2b_512_b64 = blake2b_512_b64('data string'); | |
47 | $blake2b_512_b64u = blake2b_512_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2b_512_raw = blake2b_512_file('filename.dat'); | |
50 | $blake2b_512_hex = blake2b_512_file_hex('filename.dat'); | |
51 | $blake2b_512_b64 = blake2b_512_file_b64('filename.dat'); | |
52 | $blake2b_512_b64u = blake2b_512_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2b_512_raw = blake2b_512_file(*FILEHANDLE); | |
55 | $blake2b_512_hex = blake2b_512_file_hex(*FILEHANDLE); | |
56 | $blake2b_512_b64 = blake2b_512_file_b64(*FILEHANDLE); | |
57 | $blake2b_512_b64u = blake2b_512_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2b_512; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2b_512->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2b_512 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2b_512 qw(blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u | |
82 | blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2b_512 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2b_512 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2b_512 digest encoded as a binary string. | |
93 | ||
94 | $blake2b_512_raw = blake2b_512('data string'); | |
95 | #or | |
96 | $blake2b_512_raw = blake2b_512('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2b_512_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2b_512 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2b_512_hex = blake2b_512_hex('data string'); | |
103 | #or | |
104 | $blake2b_512_hex = blake2b_512_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2b_512_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2b_512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2b_512_b64 = blake2b_512_b64('data string'); | |
111 | #or | |
112 | $blake2b_512_b64 = blake2b_512_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2b_512_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2b_512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2b_512_b64url = blake2b_512_b64u('data string'); | |
119 | #or | |
120 | $blake2b_512_b64url = blake2b_512_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2b_512_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_512 digest encoded as a binary string. | |
125 | ||
126 | $blake2b_512_raw = blake2b_512_file('filename.dat'); | |
127 | #or | |
128 | $blake2b_512_raw = blake2b_512_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2b_512_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_512 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2b_512_hex = blake2b_512_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2b_512_hex = blake2b_512_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2b_512_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2b_512_b64 = blake2b_512_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2b_512_b64 = blake2b_512_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2b_512_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2b_512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2b_512_b64url = blake2b_512_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2b_512_b64url = blake2b_512_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2b_512->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2b_512->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2b_512::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2s_128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2s_128 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2s_128_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2s_128_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2s_128_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2s_128_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2s_128_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2s_128_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2s_128_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2s_128 - Hash function BLAKE2s [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2s_128 qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u | |
41 | blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2s_128_raw = blake2s_128('data string'); | |
45 | $blake2s_128_hex = blake2s_128_hex('data string'); | |
46 | $blake2s_128_b64 = blake2s_128_b64('data string'); | |
47 | $blake2s_128_b64u = blake2s_128_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2s_128_raw = blake2s_128_file('filename.dat'); | |
50 | $blake2s_128_hex = blake2s_128_file_hex('filename.dat'); | |
51 | $blake2s_128_b64 = blake2s_128_file_b64('filename.dat'); | |
52 | $blake2s_128_b64u = blake2s_128_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2s_128_raw = blake2s_128_file(*FILEHANDLE); | |
55 | $blake2s_128_hex = blake2s_128_file_hex(*FILEHANDLE); | |
56 | $blake2s_128_b64 = blake2s_128_file_b64(*FILEHANDLE); | |
57 | $blake2s_128_b64u = blake2s_128_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2s_128; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2s_128->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2s_128 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2s_128 qw(blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u | |
82 | blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2s_128 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2s_128 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2s_128 digest encoded as a binary string. | |
93 | ||
94 | $blake2s_128_raw = blake2s_128('data string'); | |
95 | #or | |
96 | $blake2s_128_raw = blake2s_128('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2s_128_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2s_128 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2s_128_hex = blake2s_128_hex('data string'); | |
103 | #or | |
104 | $blake2s_128_hex = blake2s_128_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2s_128_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2s_128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2s_128_b64 = blake2s_128_b64('data string'); | |
111 | #or | |
112 | $blake2s_128_b64 = blake2s_128_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2s_128_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2s_128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2s_128_b64url = blake2s_128_b64u('data string'); | |
119 | #or | |
120 | $blake2s_128_b64url = blake2s_128_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2s_128_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_128 digest encoded as a binary string. | |
125 | ||
126 | $blake2s_128_raw = blake2s_128_file('filename.dat'); | |
127 | #or | |
128 | $blake2s_128_raw = blake2s_128_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2s_128_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_128 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2s_128_hex = blake2s_128_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2s_128_hex = blake2s_128_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2s_128_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2s_128_b64 = blake2s_128_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2s_128_b64 = blake2s_128_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2s_128_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2s_128_b64url = blake2s_128_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2s_128_b64url = blake2s_128_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2s_128->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2s_128->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2s_128::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2s_160; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2s_160 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2s_160_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2s_160_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2s_160_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2s_160_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2s_160_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2s_160_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2s_160_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2s_160 - Hash function BLAKE2s [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2s_160 qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u | |
41 | blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2s_160_raw = blake2s_160('data string'); | |
45 | $blake2s_160_hex = blake2s_160_hex('data string'); | |
46 | $blake2s_160_b64 = blake2s_160_b64('data string'); | |
47 | $blake2s_160_b64u = blake2s_160_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2s_160_raw = blake2s_160_file('filename.dat'); | |
50 | $blake2s_160_hex = blake2s_160_file_hex('filename.dat'); | |
51 | $blake2s_160_b64 = blake2s_160_file_b64('filename.dat'); | |
52 | $blake2s_160_b64u = blake2s_160_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2s_160_raw = blake2s_160_file(*FILEHANDLE); | |
55 | $blake2s_160_hex = blake2s_160_file_hex(*FILEHANDLE); | |
56 | $blake2s_160_b64 = blake2s_160_file_b64(*FILEHANDLE); | |
57 | $blake2s_160_b64u = blake2s_160_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2s_160; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2s_160->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2s_160 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2s_160 qw(blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u | |
82 | blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2s_160 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2s_160 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2s_160 digest encoded as a binary string. | |
93 | ||
94 | $blake2s_160_raw = blake2s_160('data string'); | |
95 | #or | |
96 | $blake2s_160_raw = blake2s_160('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2s_160_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2s_160 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2s_160_hex = blake2s_160_hex('data string'); | |
103 | #or | |
104 | $blake2s_160_hex = blake2s_160_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2s_160_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2s_160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2s_160_b64 = blake2s_160_b64('data string'); | |
111 | #or | |
112 | $blake2s_160_b64 = blake2s_160_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2s_160_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2s_160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2s_160_b64url = blake2s_160_b64u('data string'); | |
119 | #or | |
120 | $blake2s_160_b64url = blake2s_160_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2s_160_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_160 digest encoded as a binary string. | |
125 | ||
126 | $blake2s_160_raw = blake2s_160_file('filename.dat'); | |
127 | #or | |
128 | $blake2s_160_raw = blake2s_160_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2s_160_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_160 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2s_160_hex = blake2s_160_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2s_160_hex = blake2s_160_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2s_160_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2s_160_b64 = blake2s_160_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2s_160_b64 = blake2s_160_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2s_160_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2s_160_b64url = blake2s_160_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2s_160_b64url = blake2s_160_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2s_160->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2s_160->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2s_160::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2s_224; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2s_224 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2s_224_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2s_224_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2s_224_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2s_224_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2s_224_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2s_224_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2s_224_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2s_224 - Hash function BLAKE2s [size: 224 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2s_224 qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u | |
41 | blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2s_224_raw = blake2s_224('data string'); | |
45 | $blake2s_224_hex = blake2s_224_hex('data string'); | |
46 | $blake2s_224_b64 = blake2s_224_b64('data string'); | |
47 | $blake2s_224_b64u = blake2s_224_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2s_224_raw = blake2s_224_file('filename.dat'); | |
50 | $blake2s_224_hex = blake2s_224_file_hex('filename.dat'); | |
51 | $blake2s_224_b64 = blake2s_224_file_b64('filename.dat'); | |
52 | $blake2s_224_b64u = blake2s_224_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2s_224_raw = blake2s_224_file(*FILEHANDLE); | |
55 | $blake2s_224_hex = blake2s_224_file_hex(*FILEHANDLE); | |
56 | $blake2s_224_b64 = blake2s_224_file_b64(*FILEHANDLE); | |
57 | $blake2s_224_b64u = blake2s_224_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2s_224; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2s_224->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2s_224 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2s_224 qw(blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u | |
82 | blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2s_224 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2s_224 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2s_224 digest encoded as a binary string. | |
93 | ||
94 | $blake2s_224_raw = blake2s_224('data string'); | |
95 | #or | |
96 | $blake2s_224_raw = blake2s_224('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2s_224_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2s_224 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2s_224_hex = blake2s_224_hex('data string'); | |
103 | #or | |
104 | $blake2s_224_hex = blake2s_224_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2s_224_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2s_224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2s_224_b64 = blake2s_224_b64('data string'); | |
111 | #or | |
112 | $blake2s_224_b64 = blake2s_224_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2s_224_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2s_224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2s_224_b64url = blake2s_224_b64u('data string'); | |
119 | #or | |
120 | $blake2s_224_b64url = blake2s_224_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2s_224_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_224 digest encoded as a binary string. | |
125 | ||
126 | $blake2s_224_raw = blake2s_224_file('filename.dat'); | |
127 | #or | |
128 | $blake2s_224_raw = blake2s_224_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2s_224_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_224 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2s_224_hex = blake2s_224_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2s_224_hex = blake2s_224_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2s_224_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2s_224_b64 = blake2s_224_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2s_224_b64 = blake2s_224_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2s_224_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2s_224_b64url = blake2s_224_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2s_224_b64url = blake2s_224_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2s_224->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2s_224->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2s_224::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
0 | package Crypt::Digest::BLAKE2s_256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Digest Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use Carp; | |
14 | $Carp::Internal{(__PACKAGE__)}++; | |
15 | use CryptX; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub blake2s_256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub blake2s_256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub blake2s_256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub blake2s_256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub blake2s_256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub blake2s_256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub blake2s_256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub blake2s_256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::BLAKE2s_256 - Hash function BLAKE2s [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::BLAKE2s_256 qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u | |
41 | blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $blake2s_256_raw = blake2s_256('data string'); | |
45 | $blake2s_256_hex = blake2s_256_hex('data string'); | |
46 | $blake2s_256_b64 = blake2s_256_b64('data string'); | |
47 | $blake2s_256_b64u = blake2s_256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $blake2s_256_raw = blake2s_256_file('filename.dat'); | |
50 | $blake2s_256_hex = blake2s_256_file_hex('filename.dat'); | |
51 | $blake2s_256_b64 = blake2s_256_file_b64('filename.dat'); | |
52 | $blake2s_256_b64u = blake2s_256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $blake2s_256_raw = blake2s_256_file(*FILEHANDLE); | |
55 | $blake2s_256_hex = blake2s_256_file_hex(*FILEHANDLE); | |
56 | $blake2s_256_b64 = blake2s_256_file_b64(*FILEHANDLE); | |
57 | $blake2s_256_b64u = blake2s_256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::BLAKE2s_256; | |
61 | ||
62 | $d = Crypt::Digest::BLAKE2s_256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the BLAKE2s_256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::BLAKE2s_256 qw(blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u | |
82 | blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::BLAKE2s_256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 blake2s_256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its BLAKE2s_256 digest encoded as a binary string. | |
93 | ||
94 | $blake2s_256_raw = blake2s_256('data string'); | |
95 | #or | |
96 | $blake2s_256_raw = blake2s_256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 blake2s_256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its BLAKE2s_256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $blake2s_256_hex = blake2s_256_hex('data string'); | |
103 | #or | |
104 | $blake2s_256_hex = blake2s_256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 blake2s_256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its BLAKE2s_256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $blake2s_256_b64 = blake2s_256_b64('data string'); | |
111 | #or | |
112 | $blake2s_256_b64 = blake2s_256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 blake2s_256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its BLAKE2s_256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $blake2s_256_b64url = blake2s_256_b64u('data string'); | |
119 | #or | |
120 | $blake2s_256_b64url = blake2s_256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 blake2s_256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_256 digest encoded as a binary string. | |
125 | ||
126 | $blake2s_256_raw = blake2s_256_file('filename.dat'); | |
127 | #or | |
128 | $blake2s_256_raw = blake2s_256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 blake2s_256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $blake2s_256_hex = blake2s_256_file_hex('filename.dat'); | |
135 | #or | |
136 | $blake2s_256_hex = blake2s_256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 blake2s_256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $blake2s_256_b64 = blake2s_256_file_b64('filename.dat'); | |
145 | #or | |
146 | $blake2s_256_b64 = blake2s_256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 blake2s_256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its BLAKE2s_256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $blake2s_256_b64url = blake2s_256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $blake2s_256_b64url = blake2s_256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::BLAKE2s_256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->add_bits($bit_string); # e.g. $d->add_bits("111100001010"); | |
187 | #or | |
188 | $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::BLAKE2s_256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::BLAKE2s_256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over | |
217 | ||
218 | =item * L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item * L<https://blake2.net/|https://blake2.net/> | |
221 | ||
222 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
223 | ||
224 | =back | |
225 | ||
226 | =cut | |
227 | ||
228 | __END__⏎ |
27 | 27 | sub _trans_digest_name { |
28 | 28 | my $name = shift; |
29 | 29 | my %trans = ( |
30 | CHAES => 'chc_hash', | |
31 | RIPEMD128 => 'rmd128', | |
32 | RIPEMD160 => 'rmd160', | |
33 | RIPEMD256 => 'rmd256', | |
34 | RIPEMD320 => 'rmd320', | |
35 | TIGER192 => 'tiger', | |
36 | SHA512_224=> 'sha512-224', | |
37 | SHA512_256=> 'sha512-256', | |
30 | CHAES => 'chc_hash', | |
31 | RIPEMD128 => 'rmd128', | |
32 | RIPEMD160 => 'rmd160', | |
33 | RIPEMD256 => 'rmd256', | |
34 | RIPEMD320 => 'rmd320', | |
35 | TIGER192 => 'tiger', | |
36 | SHA512_224 => 'sha512-224', | |
37 | SHA512_256 => 'sha512-256', | |
38 | SHA3_224 => 'sha3-224', | |
39 | SHA3_256 => 'sha3-256', | |
40 | SHA3_384 => 'sha3-384', | |
41 | SHA3_512 => 'sha3-512', | |
42 | BLAKE2B_160 => 'blake2b-160', | |
43 | BLAKE2B_256 => 'blake2b-256', | |
44 | BLAKE2B_384 => 'blake2b-384', | |
45 | BLAKE2B_512 => 'blake2b-512', | |
46 | BLAKE2S_128 => 'blake2s-128', | |
47 | BLAKE2S_160 => 'blake2s-160', | |
48 | BLAKE2S_224 => 'blake2s-224', | |
49 | BLAKE2S_256 => 'blake2s-256', | |
38 | 50 | ); |
39 | 51 | $name =~ s/^Crypt::Digest:://i; |
40 | 52 | return $trans{uc($name)} if defined $trans{uc($name)}; |
0 | package Crypt::Mac::BLAKE2b; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Mac Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2b blake2b_hex blake2b_b64 blake2b_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use CryptX; | |
14 | sub new { my $class = shift; _new(@_) } | |
15 | sub blake2b { Crypt::Mac::BLAKE2b->new(shift, shift)->add(@_)->mac } | |
16 | sub blake2b_hex { Crypt::Mac::BLAKE2b->new(shift, shift)->add(@_)->hexmac } | |
17 | sub blake2b_b64 { Crypt::Mac::BLAKE2b->new(shift, shift)->add(@_)->b64mac } | |
18 | sub blake2b_b64u { Crypt::Mac::BLAKE2b->new(shift, shift)->add(@_)->b64umac } | |
19 | ||
20 | 1; | |
21 | ||
22 | =pod | |
23 | ||
24 | =head1 NAME | |
25 | ||
26 | Crypt::Mac::BLAKE2b - Message authentication code BLAKE2b MAC (RFC 7693) | |
27 | ||
28 | =head1 SYNOPSIS | |
29 | ||
30 | ### Functional interface: | |
31 | use Crypt::Mac::BLAKE2b qw( blake2b blake2b_hex ); | |
32 | ||
33 | # calculate MAC from string/buffer | |
34 | $blake2b_raw = blake2b($size, $key, 'data buffer'); | |
35 | $blake2b_hex = blake2b_hex($size, $key, 'data buffer'); | |
36 | $blake2b_b64 = blake2b_b64($size, $key, 'data buffer'); | |
37 | $blake2b_b64u = blake2b_b64u($size, $key, 'data buffer'); | |
38 | ||
39 | ### OO interface: | |
40 | use Crypt::Mac::BLAKE2b; | |
41 | ||
42 | $d = Crypt::Mac::BLAKE2b->new($size, $key); | |
43 | $d->add('any data'); | |
44 | $d->addfile('filename.dat'); | |
45 | $d->addfile(*FILEHANDLE); | |
46 | $result_raw = $d->mac; # raw bytes | |
47 | $result_hex = $d->hexmac; # hexadecimal form | |
48 | $result_b64 = $d->b64mac; # Base64 form | |
49 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
50 | ||
51 | =head1 DESCRIPTION | |
52 | ||
53 | Provides an interface to the BLAKE2b message authentication code (MAC) algorithm. | |
54 | ||
55 | =head1 EXPORT | |
56 | ||
57 | Nothing is exported by default. | |
58 | ||
59 | You can export selected functions: | |
60 | ||
61 | use Crypt::Mac::BLAKE2b qw(blake2b blake2b_hex ); | |
62 | ||
63 | Or all of them at once: | |
64 | ||
65 | use Crypt::Mac::BLAKE2b ':all'; | |
66 | ||
67 | =head1 FUNCTIONS | |
68 | ||
69 | =head2 blake2b | |
70 | ||
71 | Logically joins all arguments into a single string, and returns its BLAKE2b message authentication code encoded as a binary string. | |
72 | ||
73 | $blake2b_raw = blake2b($size, $key, 'data buffer'); | |
74 | #or | |
75 | $blake2b_raw = blake2b($size, $key, 'any data', 'more data', 'even more data'); | |
76 | ||
77 | =head2 blake2b_hex | |
78 | ||
79 | Logically joins all arguments into a single string, and returns its BLAKE2b message authentication code encoded as a hexadecimal string. | |
80 | ||
81 | $blake2b_hex = blake2b_hex($size, $key, 'data buffer'); | |
82 | #or | |
83 | $blake2b_hex = blake2b_hex($size, $key, 'any data', 'more data', 'even more data'); | |
84 | ||
85 | =head2 blake2b_b64 | |
86 | ||
87 | Logically joins all arguments into a single string, and returns its BLAKE2b message authentication code encoded as a Base64 string. | |
88 | ||
89 | $blake2b_b64 = blake2b_b64($size, $key, 'data buffer'); | |
90 | #or | |
91 | $blake2b_b64 = blake2b_b64($size, $key, 'any data', 'more data', 'even more data'); | |
92 | ||
93 | =head2 blake2b_b64u | |
94 | ||
95 | Logically joins all arguments into a single string, and returns its BLAKE2b message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
96 | ||
97 | $blake2b_b64url = blake2b_b64u($size, $key, 'data buffer'); | |
98 | #or | |
99 | $blake2b_b64url = blake2b_b64u($size, $key, 'any data', 'more data', 'even more data'); | |
100 | ||
101 | =head1 METHODS | |
102 | ||
103 | =head2 new | |
104 | ||
105 | $d = Crypt::Mac::BLAKE2b->new($size, $key); | |
106 | ||
107 | =head2 clone | |
108 | ||
109 | $d->clone(); | |
110 | ||
111 | =head2 reset | |
112 | ||
113 | $d->reset(); | |
114 | ||
115 | =head2 add | |
116 | ||
117 | $d->add('any data'); | |
118 | #or | |
119 | $d->add('any data', 'more data', 'even more data'); | |
120 | ||
121 | =head2 addfile | |
122 | ||
123 | $d->addfile('filename.dat'); | |
124 | #or | |
125 | $d->addfile(*FILEHANDLE); | |
126 | ||
127 | =head2 mac | |
128 | ||
129 | $result_raw = $d->mac(); | |
130 | ||
131 | =head2 hexmac | |
132 | ||
133 | $result_hex = $d->hexmac(); | |
134 | ||
135 | =head2 b64mac | |
136 | ||
137 | $result_b64 = $d->b64mac(); | |
138 | ||
139 | =head2 b64umac | |
140 | ||
141 | $result_b64url = $d->b64umac(); | |
142 | ||
143 | =head1 SEE ALSO | |
144 | ||
145 | =over | |
146 | ||
147 | =item * L<CryptX|CryptX> | |
148 | ||
149 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
150 | ||
151 | =back | |
152 | ||
153 | =cut | |
154 | ||
155 | __END__⏎ |
0 | package Crypt::Mac::BLAKE2s; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.047_004'; | |
7 | ||
8 | use base qw(Crypt::Mac Exporter); | |
9 | our %EXPORT_TAGS = ( all => [qw( blake2s blake2s_hex blake2s_b64 blake2s_b64u )] ); | |
10 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
11 | our @EXPORT = qw(); | |
12 | ||
13 | use CryptX; | |
14 | sub new { my $class = shift; _new(@_) } | |
15 | sub blake2s { Crypt::Mac::BLAKE2s->new(shift, shift)->add(@_)->mac } | |
16 | sub blake2s_hex { Crypt::Mac::BLAKE2s->new(shift, shift)->add(@_)->hexmac } | |
17 | sub blake2s_b64 { Crypt::Mac::BLAKE2s->new(shift, shift)->add(@_)->b64mac } | |
18 | sub blake2s_b64u { Crypt::Mac::BLAKE2s->new(shift, shift)->add(@_)->b64umac } | |
19 | ||
20 | 1; | |
21 | ||
22 | =pod | |
23 | ||
24 | =head1 NAME | |
25 | ||
26 | Crypt::Mac::BLAKE2s - Message authentication code BLAKE2s MAC (RFC 7693) | |
27 | ||
28 | =head1 SYNOPSIS | |
29 | ||
30 | ### Functional interface: | |
31 | use Crypt::Mac::BLAKE2s qw( blake2s blake2s_hex ); | |
32 | ||
33 | # calculate MAC from string/buffer | |
34 | $blake2s_raw = blake2s($size, $key, 'data buffer'); | |
35 | $blake2s_hex = blake2s_hex($size, $key, 'data buffer'); | |
36 | $blake2s_b64 = blake2s_b64($size, $key, 'data buffer'); | |
37 | $blake2s_b64u = blake2s_b64u($size, $key, 'data buffer'); | |
38 | ||
39 | ### OO interface: | |
40 | use Crypt::Mac::BLAKE2s; | |
41 | ||
42 | $d = Crypt::Mac::BLAKE2s->new($size, $key); | |
43 | $d->add('any data'); | |
44 | $d->addfile('filename.dat'); | |
45 | $d->addfile(*FILEHANDLE); | |
46 | $result_raw = $d->mac; # raw bytes | |
47 | $result_hex = $d->hexmac; # hexadecimal form | |
48 | $result_b64 = $d->b64mac; # Base64 form | |
49 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
50 | ||
51 | =head1 DESCRIPTION | |
52 | ||
53 | Provides an interface to the BLAKE2s message authentication code (MAC) algorithm. | |
54 | ||
55 | =head1 EXPORT | |
56 | ||
57 | Nothing is exported by default. | |
58 | ||
59 | You can export selected functions: | |
60 | ||
61 | use Crypt::Mac::BLAKE2s qw(blake2s blake2s_hex ); | |
62 | ||
63 | Or all of them at once: | |
64 | ||
65 | use Crypt::Mac::BLAKE2s ':all'; | |
66 | ||
67 | =head1 FUNCTIONS | |
68 | ||
69 | =head2 blake2s | |
70 | ||
71 | Logically joins all arguments into a single string, and returns its BLAKE2s message authentication code encoded as a binary string. | |
72 | ||
73 | $blake2s_raw = blake2s($size, $key, 'data buffer'); | |
74 | #or | |
75 | $blake2s_raw = blake2s($size, $key, 'any data', 'more data', 'even more data'); | |
76 | ||
77 | =head2 blake2s_hex | |
78 | ||
79 | Logically joins all arguments into a single string, and returns its BLAKE2s message authentication code encoded as a hexadecimal string. | |
80 | ||
81 | $blake2s_hex = blake2s_hex($size, $key, 'data buffer'); | |
82 | #or | |
83 | $blake2s_hex = blake2s_hex($size, $key, 'any data', 'more data', 'even more data'); | |
84 | ||
85 | =head2 blake2s_b64 | |
86 | ||
87 | Logically joins all arguments into a single string, and returns its BLAKE2s message authentication code encoded as a Base64 string. | |
88 | ||
89 | $blake2s_b64 = blake2s_b64($size, $key, 'data buffer'); | |
90 | #or | |
91 | $blake2s_b64 = blake2s_b64($size, $key, 'any data', 'more data', 'even more data'); | |
92 | ||
93 | =head2 blake2s_b64u | |
94 | ||
95 | Logically joins all arguments into a single string, and returns its BLAKE2s message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
96 | ||
97 | $blake2s_b64url = blake2s_b64u($size, $key, 'data buffer'); | |
98 | #or | |
99 | $blake2s_b64url = blake2s_b64u($size, $key, 'any data', 'more data', 'even more data'); | |
100 | ||
101 | =head1 METHODS | |
102 | ||
103 | =head2 new | |
104 | ||
105 | $d = Crypt::Mac::BLAKE2s->new($size, $key); | |
106 | ||
107 | =head2 clone | |
108 | ||
109 | $d->clone(); | |
110 | ||
111 | =head2 reset | |
112 | ||
113 | $d->reset(); | |
114 | ||
115 | =head2 add | |
116 | ||
117 | $d->add('any data'); | |
118 | #or | |
119 | $d->add('any data', 'more data', 'even more data'); | |
120 | ||
121 | =head2 addfile | |
122 | ||
123 | $d->addfile('filename.dat'); | |
124 | #or | |
125 | $d->addfile(*FILEHANDLE); | |
126 | ||
127 | =head2 mac | |
128 | ||
129 | $result_raw = $d->mac(); | |
130 | ||
131 | =head2 hexmac | |
132 | ||
133 | $result_hex = $d->hexmac(); | |
134 | ||
135 | =head2 b64mac | |
136 | ||
137 | $result_b64 = $d->b64mac(); | |
138 | ||
139 | =head2 b64umac | |
140 | ||
141 | $result_b64url = $d->b64umac(); | |
142 | ||
143 | =head1 SEE ALSO | |
144 | ||
145 | =over | |
146 | ||
147 | =item * L<CryptX|CryptX> | |
148 | ||
149 | =item * L<https://tools.ietf.org/html/rfc7693|https://tools.ietf.org/html/rfc7693> | |
150 | ||
151 | =back | |
152 | ||
153 | =cut | |
154 | ||
155 | __END__⏎ |
0 | OBJS=ltc/ciphers/aes/aes.o ltc/ciphers/anubis.o ltc/ciphers/blowfish.o ltc/ciphers/camellia.o ltc/ciphers/cast5.o \ | |
0 | OBJS=ltc/ciphers/anubis.o ltc/ciphers/blowfish.o ltc/ciphers/camellia.o ltc/ciphers/cast5.o \ | |
1 | 1 | ltc/ciphers/des.o ltc/ciphers/kasumi.o ltc/ciphers/khazad.o ltc/ciphers/kseed.o ltc/ciphers/multi2.o \ |
2 | ltc/ciphers/noekeon.o ltc/ciphers/rc2.o ltc/ciphers/rc5.o ltc/ciphers/rc6.o ltc/ciphers/safer/safer.o \ | |
3 | ltc/ciphers/safer/saferp.o ltc/ciphers/skipjack.o ltc/ciphers/twofish/twofish.o ltc/ciphers/xtea.o \ | |
4 | ltc/stream/chacha/chacha_crypt.o ltc/stream/chacha/chacha_done.o ltc/stream/chacha/chacha_ivctr32.o \ | |
5 | ltc/stream/chacha/chacha_ivctr64.o ltc/stream/chacha/chacha_keystream.o ltc/stream/chacha/chacha_setup.o \ | |
6 | ltc/stream/rc4/rc4.o ltc/stream/sober128/sober128.o \ | |
7 | ltc/encauth/chachapoly/chacha20poly1305_add_aad.o ltc/encauth/chachapoly/chacha20poly1305_decrypt.o \ | |
8 | ltc/encauth/chachapoly/chacha20poly1305_done.o ltc/encauth/chachapoly/chacha20poly1305_encrypt.o \ | |
2 | ltc/ciphers/noekeon.o ltc/ciphers/rc2.o ltc/ciphers/rc5.o ltc/ciphers/rc6.o ltc/ciphers/skipjack.o \ | |
3 | ltc/ciphers/xtea.o ltc/ciphers/aes/aes.o ltc/ciphers/safer/safer.o ltc/ciphers/safer/saferp.o \ | |
4 | ltc/ciphers/twofish/twofish.o ltc/encauth/ccm/ccm_add_aad.o ltc/encauth/ccm/ccm_add_nonce.o \ | |
5 | ltc/encauth/ccm/ccm_done.o ltc/encauth/ccm/ccm_init.o ltc/encauth/ccm/ccm_memory.o \ | |
6 | ltc/encauth/ccm/ccm_process.o ltc/encauth/ccm/ccm_reset.o ltc/encauth/chachapoly/chacha20poly1305_add_aad.o \ | |
7 | ltc/encauth/chachapoly/chacha20poly1305_decrypt.o ltc/encauth/chachapoly/chacha20poly1305_done.o \ | |
8 | ltc/encauth/chachapoly/chacha20poly1305_encrypt.o ltc/encauth/chachapoly/chacha20poly1305_inciv.o \ | |
9 | 9 | ltc/encauth/chachapoly/chacha20poly1305_init.o ltc/encauth/chachapoly/chacha20poly1305_memory.o \ |
10 | 10 | ltc/encauth/chachapoly/chacha20poly1305_setiv.o ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \ |
11 | ltc/encauth/chachapoly/chacha20poly1305_inciv.o \ | |
12 | ltc/encauth/ccm/ccm_add_aad.o ltc/encauth/ccm/ccm_add_nonce.o ltc/encauth/ccm/ccm_done.o ltc/encauth/ccm/ccm_init.o \ | |
13 | ltc/encauth/ccm/ccm_memory.o ltc/encauth/ccm/ccm_process.o ltc/encauth/ccm/ccm_reset.o \ | |
14 | 11 | ltc/encauth/eax/eax_addheader.o ltc/encauth/eax/eax_decrypt.o ltc/encauth/eax/eax_decrypt_verify_memory.o \ |
15 | 12 | ltc/encauth/eax/eax_done.o ltc/encauth/eax/eax_encrypt.o ltc/encauth/eax/eax_encrypt_authenticate_memory.o \ |
16 | ltc/encauth/eax/eax_init.o ltc/encauth/gcm/gcm_add_aad.o ltc/encauth/gcm/gcm_add_iv.o ltc/encauth/gcm/gcm_done.o \ | |
17 | ltc/encauth/gcm/gcm_gf_mult.o ltc/encauth/gcm/gcm_init.o ltc/encauth/gcm/gcm_memory.o ltc/encauth/gcm/gcm_mult_h.o \ | |
18 | ltc/encauth/gcm/gcm_process.o ltc/encauth/gcm/gcm_reset.o ltc/encauth/ocb3/ocb3_add_aad.o \ | |
19 | ltc/encauth/ocb3/ocb3_decrypt.o ltc/encauth/ocb3/ocb3_decrypt_last.o ltc/encauth/ocb3/ocb3_decrypt_verify_memory.o \ | |
13 | ltc/encauth/eax/eax_init.o ltc/encauth/gcm/gcm_add_aad.o ltc/encauth/gcm/gcm_add_iv.o \ | |
14 | ltc/encauth/gcm/gcm_done.o ltc/encauth/gcm/gcm_gf_mult.o ltc/encauth/gcm/gcm_init.o \ | |
15 | ltc/encauth/gcm/gcm_memory.o ltc/encauth/gcm/gcm_mult_h.o ltc/encauth/gcm/gcm_process.o \ | |
16 | ltc/encauth/gcm/gcm_reset.o ltc/encauth/ocb3/ocb3_add_aad.o ltc/encauth/ocb3/ocb3_decrypt.o \ | |
17 | ltc/encauth/ocb3/ocb3_decrypt_last.o ltc/encauth/ocb3/ocb3_decrypt_verify_memory.o \ | |
20 | 18 | ltc/encauth/ocb3/ocb3_done.o ltc/encauth/ocb3/ocb3_encrypt.o ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \ |
21 | 19 | ltc/encauth/ocb3/ocb3_encrypt_last.o ltc/encauth/ocb3/ocb3_init.o ltc/encauth/ocb3/ocb3_int_aad_add_block.o \ |
22 | 20 | ltc/encauth/ocb3/ocb3_int_calc_offset_zero.o ltc/encauth/ocb3/ocb3_int_ntz.o ltc/encauth/ocb3/ocb3_int_xor_blocks.o \ |
23 | ltc/hashes/chc/chc.o ltc/hashes/helper/hash_file.o ltc/hashes/helper/hash_filehandle.o ltc/hashes/helper/hash_memory.o \ | |
24 | ltc/hashes/helper/hash_memory_multi.o ltc/hashes/md2.o ltc/hashes/md4.o ltc/hashes/md5.o ltc/hashes/rmd128.o \ | |
25 | ltc/hashes/rmd160.o ltc/hashes/rmd256.o ltc/hashes/rmd320.o ltc/hashes/sha1.o ltc/hashes/sha2/sha224.o \ | |
26 | ltc/hashes/sha2/sha256.o ltc/hashes/sha2/sha384.o ltc/hashes/sha2/sha512.o ltc/hashes/sha2/sha512_224.o \ | |
27 | ltc/hashes/sha2/sha512_256.o ltc/hashes/tiger.o ltc/hashes/whirl/whirl.o ltc/hashes/sha3.o ltc/hashes/sha3_test.o \ | |
28 | ltc/mac/poly1305/poly1305.o ltc/mac/poly1305/poly1305_file.o ltc/mac/poly1305/poly1305_memory.o ltc/mac/poly1305/poly1305_memory_multi.o \ | |
29 | ltc/mac/f9/f9_done.o ltc/mac/f9/f9_file.o ltc/mac/f9/f9_init.o ltc/mac/f9/f9_memory.o ltc/mac/f9/f9_memory_multi.o ltc/mac/f9/f9_process.o \ | |
30 | ltc/mac/hmac/hmac_done.o ltc/mac/hmac/hmac_file.o ltc/mac/hmac/hmac_init.o ltc/mac/hmac/hmac_memory.o \ | |
31 | ltc/mac/hmac/hmac_memory_multi.o ltc/mac/hmac/hmac_process.o ltc/mac/omac/omac_done.o ltc/mac/omac/omac_file.o \ | |
32 | ltc/mac/omac/omac_init.o ltc/mac/omac/omac_memory.o ltc/mac/omac/omac_memory_multi.o ltc/mac/omac/omac_process.o \ | |
33 | ltc/mac/pelican/pelican.o ltc/mac/pelican/pelican_memory.o ltc/mac/pmac/pmac_done.o ltc/mac/pmac/pmac_file.o \ | |
34 | ltc/mac/pmac/pmac_init.o ltc/mac/pmac/pmac_memory.o ltc/mac/pmac/pmac_memory_multi.o ltc/mac/pmac/pmac_ntz.o \ | |
35 | ltc/mac/pmac/pmac_process.o ltc/mac/pmac/pmac_shift_xor.o ltc/mac/xcbc/xcbc_done.o ltc/mac/xcbc/xcbc_file.o \ | |
36 | ltc/mac/xcbc/xcbc_init.o ltc/mac/xcbc/xcbc_memory.o ltc/mac/xcbc/xcbc_memory_multi.o ltc/mac/xcbc/xcbc_process.o \ | |
37 | ltc/math/fp/ltc_ecc_fp_mulmod.o ltc/math/ltm_desc.o ltc/math/multi.o ltc/math/rand_bn.o ltc/math/rand_prime.o \ | |
38 | ltc/math/tfm_desc.o ltc/misc/crc32.o ltc/misc/adler32.o ltc/misc/base64/base64_decode.o ltc/misc/base64/base64_encode.o ltc/misc/burn_stack.o \ | |
21 | ltc/hashes/blake2b.o ltc/hashes/blake2s.o ltc/hashes/md2.o ltc/hashes/md4.o ltc/hashes/md5.o \ | |
22 | ltc/hashes/rmd128.o ltc/hashes/rmd160.o ltc/hashes/rmd256.o ltc/hashes/rmd320.o ltc/hashes/sha1.o \ | |
23 | ltc/hashes/sha3.o ltc/hashes/sha3_test.o ltc/hashes/tiger.o ltc/hashes/chc/chc.o \ | |
24 | ltc/hashes/helper/hash_file.o ltc/hashes/helper/hash_filehandle.o ltc/hashes/helper/hash_memory.o \ | |
25 | ltc/hashes/helper/hash_memory_multi.o ltc/hashes/sha2/sha224.o ltc/hashes/sha2/sha256.o \ | |
26 | ltc/hashes/sha2/sha384.o ltc/hashes/sha2/sha512.o ltc/hashes/sha2/sha512_224.o ltc/hashes/sha2/sha512_256.o \ | |
27 | ltc/hashes/whirl/whirl.o ltc/mac/blake2/blake2bmac.o ltc/mac/blake2/blake2bmac_file.o \ | |
28 | ltc/mac/blake2/blake2bmac_memory.o ltc/mac/blake2/blake2bmac_memory_multi.o ltc/mac/blake2/blake2smac.o \ | |
29 | ltc/mac/blake2/blake2smac_file.o ltc/mac/blake2/blake2smac_memory.o ltc/mac/blake2/blake2smac_memory_multi.o \ | |
30 | ltc/mac/f9/f9_done.o ltc/mac/f9/f9_file.o ltc/mac/f9/f9_init.o ltc/mac/f9/f9_memory.o \ | |
31 | ltc/mac/f9/f9_memory_multi.o ltc/mac/f9/f9_process.o ltc/mac/hmac/hmac_done.o ltc/mac/hmac/hmac_file.o \ | |
32 | ltc/mac/hmac/hmac_init.o ltc/mac/hmac/hmac_memory.o ltc/mac/hmac/hmac_memory_multi.o \ | |
33 | ltc/mac/hmac/hmac_process.o ltc/mac/omac/omac_done.o ltc/mac/omac/omac_file.o ltc/mac/omac/omac_init.o \ | |
34 | ltc/mac/omac/omac_memory.o ltc/mac/omac/omac_memory_multi.o ltc/mac/omac/omac_process.o \ | |
35 | ltc/mac/pelican/pelican.o ltc/mac/pelican/pelican_memory.o ltc/mac/pmac/pmac_done.o \ | |
36 | ltc/mac/pmac/pmac_file.o ltc/mac/pmac/pmac_init.o ltc/mac/pmac/pmac_memory.o ltc/mac/pmac/pmac_memory_multi.o \ | |
37 | ltc/mac/pmac/pmac_ntz.o ltc/mac/pmac/pmac_process.o ltc/mac/pmac/pmac_shift_xor.o \ | |
38 | ltc/mac/poly1305/poly1305.o ltc/mac/poly1305/poly1305_file.o ltc/mac/poly1305/poly1305_memory.o \ | |
39 | ltc/mac/poly1305/poly1305_memory_multi.o ltc/mac/xcbc/xcbc_done.o ltc/mac/xcbc/xcbc_file.o \ | |
40 | ltc/mac/xcbc/xcbc_init.o ltc/mac/xcbc/xcbc_memory.o ltc/mac/xcbc/xcbc_memory_multi.o \ | |
41 | ltc/mac/xcbc/xcbc_process.o ltc/math/ltm_desc.o ltc/math/multi.o ltc/math/rand_bn.o \ | |
42 | ltc/math/rand_prime.o ltc/math/tfm_desc.o ltc/math/fp/ltc_ecc_fp_mulmod.o ltc/misc/adler32.o \ | |
43 | ltc/misc/burn_stack.o ltc/misc/crc32.o ltc/misc/error_to_string.o ltc/misc/mem_neq.o \ | |
44 | ltc/misc/pk_get_oid.o ltc/misc/zeromem.o ltc/misc/base64/base64_decode.o ltc/misc/base64/base64_encode.o \ | |
39 | 45 | ltc/misc/crypt/crypt.o ltc/misc/crypt/crypt_argchk.o ltc/misc/crypt/crypt_cipher_descriptor.o \ |
40 | 46 | ltc/misc/crypt/crypt_cipher_is_valid.o ltc/misc/crypt/crypt_find_cipher.o ltc/misc/crypt/crypt_find_cipher_any.o \ |
41 | 47 | ltc/misc/crypt/crypt_find_cipher_id.o ltc/misc/crypt/crypt_find_hash.o ltc/misc/crypt/crypt_find_hash_any.o \ |
44 | 50 | ltc/misc/crypt/crypt_inits.o ltc/misc/crypt/crypt_ltc_mp_descriptor.o ltc/misc/crypt/crypt_prng_descriptor.o \ |
45 | 51 | ltc/misc/crypt/crypt_prng_is_valid.o ltc/misc/crypt/crypt_register_cipher.o ltc/misc/crypt/crypt_register_hash.o \ |
46 | 52 | ltc/misc/crypt/crypt_register_prng.o ltc/misc/crypt/crypt_unregister_cipher.o ltc/misc/crypt/crypt_unregister_hash.o \ |
47 | ltc/misc/crypt/crypt_unregister_prng.o ltc/misc/error_to_string.o ltc/misc/hkdf/hkdf.o ltc/misc/mem_neq.o \ | |
48 | ltc/misc/pkcs5/pkcs_5_1.o ltc/misc/pkcs5/pkcs_5_2.o ltc/misc/pk_get_oid.o ltc/misc/zeromem.o \ | |
49 | ltc/modes/cbc/cbc_decrypt.o ltc/modes/cbc/cbc_done.o ltc/modes/cbc/cbc_encrypt.o ltc/modes/cbc/cbc_getiv.o \ | |
50 | ltc/modes/cbc/cbc_setiv.o ltc/modes/cbc/cbc_start.o ltc/modes/cfb/cfb_decrypt.o ltc/modes/cfb/cfb_done.o \ | |
51 | ltc/modes/cfb/cfb_encrypt.o ltc/modes/cfb/cfb_getiv.o ltc/modes/cfb/cfb_setiv.o ltc/modes/cfb/cfb_start.o \ | |
52 | ltc/modes/ctr/ctr_decrypt.o ltc/modes/ctr/ctr_done.o ltc/modes/ctr/ctr_encrypt.o ltc/modes/ctr/ctr_getiv.o \ | |
53 | ltc/modes/ctr/ctr_setiv.o ltc/modes/ctr/ctr_start.o ltc/modes/ecb/ecb_decrypt.o ltc/modes/ecb/ecb_done.o \ | |
54 | ltc/modes/ecb/ecb_encrypt.o ltc/modes/ecb/ecb_start.o ltc/modes/ofb/ofb_decrypt.o ltc/modes/ofb/ofb_done.o \ | |
55 | ltc/modes/ofb/ofb_encrypt.o ltc/modes/ofb/ofb_getiv.o ltc/modes/ofb/ofb_setiv.o ltc/modes/ofb/ofb_start.o \ | |
56 | ltc/pk/asn1/der/bit/der_decode_bit_string.o ltc/pk/asn1/der/bit/der_decode_raw_bit_string.o \ | |
53 | ltc/misc/crypt/crypt_unregister_prng.o ltc/misc/hkdf/hkdf.o ltc/misc/pkcs5/pkcs_5_1.o \ | |
54 | ltc/misc/pkcs5/pkcs_5_2.o ltc/modes/cbc/cbc_decrypt.o ltc/modes/cbc/cbc_done.o ltc/modes/cbc/cbc_encrypt.o \ | |
55 | ltc/modes/cbc/cbc_getiv.o ltc/modes/cbc/cbc_setiv.o ltc/modes/cbc/cbc_start.o ltc/modes/cfb/cfb_decrypt.o \ | |
56 | ltc/modes/cfb/cfb_done.o ltc/modes/cfb/cfb_encrypt.o ltc/modes/cfb/cfb_getiv.o ltc/modes/cfb/cfb_setiv.o \ | |
57 | ltc/modes/cfb/cfb_start.o ltc/modes/ctr/ctr_decrypt.o ltc/modes/ctr/ctr_done.o ltc/modes/ctr/ctr_encrypt.o \ | |
58 | ltc/modes/ctr/ctr_getiv.o ltc/modes/ctr/ctr_setiv.o ltc/modes/ctr/ctr_start.o ltc/modes/ecb/ecb_decrypt.o \ | |
59 | ltc/modes/ecb/ecb_done.o ltc/modes/ecb/ecb_encrypt.o ltc/modes/ecb/ecb_start.o ltc/modes/ofb/ofb_decrypt.o \ | |
60 | ltc/modes/ofb/ofb_done.o ltc/modes/ofb/ofb_encrypt.o ltc/modes/ofb/ofb_getiv.o ltc/modes/ofb/ofb_setiv.o \ | |
61 | ltc/modes/ofb/ofb_start.o ltc/pk/asn1/der/bit/der_decode_bit_string.o ltc/pk/asn1/der/bit/der_decode_raw_bit_string.o \ | |
57 | 62 | ltc/pk/asn1/der/bit/der_encode_bit_string.o ltc/pk/asn1/der/bit/der_encode_raw_bit_string.o \ |
58 | 63 | ltc/pk/asn1/der/bit/der_length_bit_string.o ltc/pk/asn1/der/boolean/der_decode_boolean.o \ |
59 | 64 | ltc/pk/asn1/der/boolean/der_encode_boolean.o ltc/pk/asn1/der/boolean/der_length_boolean.o \ |
60 | ltc/pk/asn1/der/choice/der_decode_choice.o ltc/pk/asn1/der/ia5/der_decode_ia5_string.o \ | |
61 | ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.o ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \ | |
62 | ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.o \ | |
63 | ltc/pk/asn1/der/ia5/der_encode_ia5_string.o ltc/pk/asn1/der/ia5/der_length_ia5_string.o \ | |
64 | ltc/pk/asn1/der/integer/der_decode_integer.o ltc/pk/asn1/der/integer/der_encode_integer.o \ | |
65 | ltc/pk/asn1/der/integer/der_length_integer.o ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.o \ | |
66 | ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.o \ | |
65 | ltc/pk/asn1/der/choice/der_decode_choice.o ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \ | |
66 | ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.o ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.o \ | |
67 | ltc/pk/asn1/der/ia5/der_decode_ia5_string.o ltc/pk/asn1/der/ia5/der_encode_ia5_string.o \ | |
68 | ltc/pk/asn1/der/ia5/der_length_ia5_string.o ltc/pk/asn1/der/integer/der_decode_integer.o \ | |
69 | ltc/pk/asn1/der/integer/der_encode_integer.o ltc/pk/asn1/der/integer/der_length_integer.o \ | |
70 | ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.o ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.o \ | |
67 | 71 | ltc/pk/asn1/der/object_identifier/der_length_object_identifier.o ltc/pk/asn1/der/octet/der_decode_octet_string.o \ |
68 | 72 | ltc/pk/asn1/der/octet/der_encode_octet_string.o ltc/pk/asn1/der/octet/der_length_octet_string.o \ |
69 | ltc/pk/asn1/der/printable_string/der_decode_printable_string.o \ | |
70 | ltc/pk/asn1/der/printable_string/der_encode_printable_string.o \ | |
73 | ltc/pk/asn1/der/printable_string/der_decode_printable_string.o ltc/pk/asn1/der/printable_string/der_encode_printable_string.o \ | |
71 | 74 | ltc/pk/asn1/der/printable_string/der_length_printable_string.o ltc/pk/asn1/der/sequence/der_decode_sequence_ex.o \ |
72 | 75 | ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.o ltc/pk/asn1/der/sequence/der_decode_sequence_multi.o \ |
73 | 76 | ltc/pk/asn1/der/sequence/der_decode_subject_public_key_info.o ltc/pk/asn1/der/sequence/der_encode_sequence_ex.o \ |
74 | 77 | ltc/pk/asn1/der/sequence/der_encode_sequence_multi.o ltc/pk/asn1/der/sequence/der_encode_subject_public_key_info.o \ |
75 | 78 | ltc/pk/asn1/der/sequence/der_length_sequence.o ltc/pk/asn1/der/sequence/der_sequence_free.o \ |
76 | ltc/pk/asn1/der/set/der_encode_set.o ltc/pk/asn1/der/set/der_encode_setof.o \ | |
77 | ltc/pk/asn1/der/short_integer/der_decode_short_integer.o ltc/pk/asn1/der/short_integer/der_encode_short_integer.o \ | |
78 | ltc/pk/asn1/der/short_integer/der_length_short_integer.o ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.o \ | |
79 | ltc/pk/asn1/der/teletex_string/der_length_teletex_string.o ltc/pk/asn1/der/utctime/der_decode_utctime.o \ | |
80 | ltc/pk/asn1/der/utctime/der_encode_utctime.o ltc/pk/asn1/der/utctime/der_length_utctime.o \ | |
81 | ltc/pk/asn1/der/utf8/der_decode_utf8_string.o ltc/pk/asn1/der/utf8/der_encode_utf8_string.o \ | |
82 | ltc/pk/asn1/der/utf8/der_length_utf8_string.o ltc/pk/dh/dh.o ltc/pk/dh/dh_static.o ltc/pk/dh/dh_sys.o \ | |
83 | ltc/pk/dsa/dsa_decrypt_key.o ltc/pk/dsa/dsa_encrypt_key.o ltc/pk/dsa/dsa_export.o ltc/pk/dsa/dsa_free.o \ | |
84 | ltc/pk/dsa/dsa_import.o ltc/pk/dsa/dsa_import_radix.o ltc/pk/dsa/dsa_make_key.o ltc/pk/dsa/dsa_shared_secret.o \ | |
85 | ltc/pk/dsa/dsa_sign_hash.o ltc/pk/dsa/dsa_verify_hash.o ltc/pk/dsa/dsa_verify_key.o ltc/pk/ecc/ecc.o \ | |
86 | ltc/pk/ecc/ecc_ansi_x963_export.o ltc/pk/ecc/ecc_ansi_x963_import.o ltc/pk/ecc/ecc_decrypt_key.o \ | |
87 | ltc/pk/ecc/ecc_dp_clear.o ltc/pk/ecc/ecc_dp_fill_from_sets.o ltc/pk/ecc/ecc_dp_from_oid.o \ | |
88 | ltc/pk/ecc/ecc_dp_from_params.o ltc/pk/ecc/ecc_dp_init.o ltc/pk/ecc/ecc_dp_set.o \ | |
89 | ltc/pk/ecc/ecc_encrypt_key.o ltc/pk/ecc/ecc_export.o ltc/pk/ecc/ecc_export_full.o \ | |
79 | ltc/pk/asn1/der/set/der_encode_set.o ltc/pk/asn1/der/set/der_encode_setof.o ltc/pk/asn1/der/short_integer/der_decode_short_integer.o \ | |
80 | ltc/pk/asn1/der/short_integer/der_encode_short_integer.o ltc/pk/asn1/der/short_integer/der_length_short_integer.o \ | |
81 | ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.o ltc/pk/asn1/der/teletex_string/der_length_teletex_string.o \ | |
82 | ltc/pk/asn1/der/utctime/der_decode_utctime.o ltc/pk/asn1/der/utctime/der_encode_utctime.o \ | |
83 | ltc/pk/asn1/der/utctime/der_length_utctime.o ltc/pk/asn1/der/utf8/der_decode_utf8_string.o \ | |
84 | ltc/pk/asn1/der/utf8/der_encode_utf8_string.o ltc/pk/asn1/der/utf8/der_length_utf8_string.o \ | |
85 | ltc/pk/dh/dh.o ltc/pk/dh/dh_static.o ltc/pk/dh/dh_sys.o ltc/pk/dsa/dsa_decrypt_key.o \ | |
86 | ltc/pk/dsa/dsa_encrypt_key.o ltc/pk/dsa/dsa_export.o ltc/pk/dsa/dsa_free.o ltc/pk/dsa/dsa_import.o \ | |
87 | ltc/pk/dsa/dsa_import_radix.o ltc/pk/dsa/dsa_make_key.o ltc/pk/dsa/dsa_shared_secret.o \ | |
88 | ltc/pk/dsa/dsa_sign_hash.o ltc/pk/dsa/dsa_verify_hash.o ltc/pk/dsa/dsa_verify_key.o \ | |
89 | ltc/pk/ecc/ecc.o ltc/pk/ecc/ecc_ansi_x963_export.o ltc/pk/ecc/ecc_ansi_x963_import.o \ | |
90 | ltc/pk/ecc/ecc_decrypt_key.o ltc/pk/ecc/ecc_dp_clear.o ltc/pk/ecc/ecc_dp_fill_from_sets.o \ | |
91 | ltc/pk/ecc/ecc_dp_from_oid.o ltc/pk/ecc/ecc_dp_from_params.o ltc/pk/ecc/ecc_dp_init.o \ | |
92 | ltc/pk/ecc/ecc_dp_set.o ltc/pk/ecc/ecc_encrypt_key.o ltc/pk/ecc/ecc_export.o ltc/pk/ecc/ecc_export_full.o \ | |
90 | 93 | ltc/pk/ecc/ecc_export_raw.o ltc/pk/ecc/ecc_free.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o \ |
91 | 94 | ltc/pk/ecc/ecc_import_full.o ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_raw.o \ |
92 | ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o ltc/pk/ecc/ecc_sizes.o \ | |
93 | ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ecc_verify_key.o ltc/pk/ecc/ltc_ecc_is_point.o \ | |
94 | ltc/pk/ecc/ltc_ecc_is_valid_idx.o ltc/pk/ecc/ltc_ecc_map.o ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o \ | |
95 | ltc/pk/ecc/ltc_ecc_mulmod_timing.o ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o \ | |
96 | ltc/pk/ecc/ltc_ecc_projective_dbl_point.o ltc/pk/pkcs1/pkcs_1_i2osp.o ltc/pk/pkcs1/pkcs_1_mgf1.o \ | |
97 | ltc/pk/ecc/ltc_ecc_export_point.o ltc/pk/ecc/ltc_ecc_import_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o \ | |
98 | ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o ltc/pk/pkcs1/pkcs_1_os2ip.o \ | |
99 | ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o ltc/pk/pkcs1/pkcs_1_v1_5_decode.o \ | |
100 | ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o ltc/pk/rsa/rsa_encrypt_key.o ltc/pk/rsa/rsa_export.o \ | |
95 | ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o \ | |
96 | ltc/pk/ecc/ecc_sizes.o ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ecc_verify_key.o ltc/pk/ecc/ltc_ecc_export_point.o \ | |
97 | ltc/pk/ecc/ltc_ecc_import_point.o ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o \ | |
98 | ltc/pk/ecc/ltc_ecc_is_valid_idx.o ltc/pk/ecc/ltc_ecc_map.o ltc/pk/ecc/ltc_ecc_mul2add.o \ | |
99 | ltc/pk/ecc/ltc_ecc_mulmod.o ltc/pk/ecc/ltc_ecc_mulmod_timing.o ltc/pk/ecc/ltc_ecc_points.o \ | |
100 | ltc/pk/ecc/ltc_ecc_projective_add_point.o ltc/pk/ecc/ltc_ecc_projective_dbl_point.o \ | |
101 | ltc/pk/pkcs1/pkcs_1_i2osp.o ltc/pk/pkcs1/pkcs_1_mgf1.o ltc/pk/pkcs1/pkcs_1_oaep_decode.o \ | |
102 | ltc/pk/pkcs1/pkcs_1_oaep_encode.o ltc/pk/pkcs1/pkcs_1_os2ip.o ltc/pk/pkcs1/pkcs_1_pss_decode.o \ | |
103 | ltc/pk/pkcs1/pkcs_1_pss_encode.o ltc/pk/pkcs1/pkcs_1_v1_5_decode.o ltc/pk/pkcs1/pkcs_1_v1_5_encode.o \ | |
104 | ltc/pk/rsa/rsa_decrypt_key.o ltc/pk/rsa/rsa_encrypt_key.o ltc/pk/rsa/rsa_export.o \ | |
101 | 105 | ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o ltc/pk/rsa/rsa_get_size.o ltc/pk/rsa/rsa_import.o \ |
102 | ltc/pk/rsa/rsa_import_radix.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o ltc/pk/rsa/rsa_make_key.o ltc/pk/rsa/rsa_sign_hash.o \ | |
103 | ltc/pk/rsa/rsa_sign_saltlen_get.o ltc/pk/rsa/rsa_verify_hash.o ltc/prngs/fortuna.o ltc/prngs/rc4.o \ | |
104 | ltc/prngs/rng_get_bytes.o ltc/prngs/rng_make_prng.o ltc/prngs/sober128.o ltc/prngs/sprng.o ltc/prngs/yarrow.o ltc/prngs/chacha20.o \ | |
105 | ltm/bn_error.o ltm/bn_fast_mp_invmod.o ltm/bn_fast_mp_montgomery_reduce.o ltm/bn_fast_s_mp_mul_digs.o \ | |
106 | ltm/bn_fast_s_mp_mul_high_digs.o ltm/bn_fast_s_mp_sqr.o ltm/bn_mp_2expt.o ltm/bn_mp_abs.o ltm/bn_mp_add.o \ | |
107 | ltm/bn_mp_add_d.o ltm/bn_mp_addmod.o ltm/bn_mp_and.o ltm/bn_mp_clamp.o ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o \ | |
108 | ltm/bn_mp_cmp.o ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o ltm/bn_mp_count_bits.o \ | |
109 | ltm/bn_mp_div.o ltm/bn_mp_div_2.o ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o \ | |
110 | ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_expt_d.o \ | |
111 | ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exptmod.o ltm/bn_mp_exptmod_fast.o ltm/bn_mp_exteuclid.o ltm/bn_mp_fread.o \ | |
112 | ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o ltm/bn_mp_get_long_long.o \ | |
106 | ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_radix.o ltc/pk/rsa/rsa_import_x509.o \ | |
107 | ltc/pk/rsa/rsa_make_key.o ltc/pk/rsa/rsa_sign_hash.o ltc/pk/rsa/rsa_sign_saltlen_get.o \ | |
108 | ltc/pk/rsa/rsa_verify_hash.o ltc/prngs/chacha20.o ltc/prngs/fortuna.o ltc/prngs/rc4.o \ | |
109 | ltc/prngs/rng_get_bytes.o ltc/prngs/rng_make_prng.o ltc/prngs/sober128.o ltc/prngs/sprng.o \ | |
110 | ltc/prngs/yarrow.o ltc/stream/chacha/chacha_crypt.o ltc/stream/chacha/chacha_done.o \ | |
111 | ltc/stream/chacha/chacha_ivctr32.o ltc/stream/chacha/chacha_ivctr64.o ltc/stream/chacha/chacha_keystream.o \ | |
112 | ltc/stream/chacha/chacha_setup.o ltc/stream/rc4/rc4.o ltc/stream/sober128/sober128.o \ | |
113 | ltm/bncore.o ltm/bn_error.o ltm/bn_fast_mp_invmod.o ltm/bn_fast_mp_montgomery_reduce.o \ | |
114 | ltm/bn_fast_s_mp_mul_digs.o ltm/bn_fast_s_mp_mul_high_digs.o ltm/bn_fast_s_mp_sqr.o \ | |
115 | ltm/bn_mp_2expt.o ltm/bn_mp_abs.o ltm/bn_mp_add.o ltm/bn_mp_addmod.o ltm/bn_mp_add_d.o \ | |
116 | ltm/bn_mp_and.o ltm/bn_mp_clamp.o ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o ltm/bn_mp_cmp.o \ | |
117 | ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o ltm/bn_mp_count_bits.o \ | |
118 | ltm/bn_mp_div.o ltm/bn_mp_div_2.o ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o ltm/bn_mp_div_d.o \ | |
119 | ltm/bn_mp_dr_is_modulus.o ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o ltm/bn_mp_exch.o \ | |
120 | ltm/bn_mp_export.o ltm/bn_mp_exptmod.o ltm/bn_mp_exptmod_fast.o ltm/bn_mp_expt_d.o \ | |
121 | ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o ltm/bn_mp_fread.o ltm/bn_mp_fwrite.o \ | |
122 | ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o ltm/bn_mp_get_long_long.o \ | |
113 | 123 | ltm/bn_mp_grow.o ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \ |
114 | ltm/bn_mp_init_set.o ltm/bn_mp_init_set_int.o ltm/bn_mp_init_size.o ltm/bn_mp_invmod.o ltm/bn_mp_invmod_slow.o \ | |
115 | ltm/bn_mp_is_square.o ltm/bn_mp_jacobi.o ltm/bn_mp_karatsuba_mul.o ltm/bn_mp_karatsuba_sqr.o ltm/bn_mp_lcm.o \ | |
116 | ltm/bn_mp_lshd.o ltm/bn_mp_mod.o ltm/bn_mp_mod_2d.o ltm/bn_mp_mod_d.o ltm/bn_mp_montgomery_calc_normalization.o \ | |
117 | ltm/bn_mp_montgomery_reduce.o ltm/bn_mp_montgomery_setup.o ltm/bn_mp_mul.o ltm/bn_mp_mul_2.o ltm/bn_mp_mul_2d.o \ | |
118 | ltm/bn_mp_mul_d.o ltm/bn_mp_mulmod.o ltm/bn_mp_n_root.o ltm/bn_mp_n_root_ex.o ltm/bn_mp_neg.o ltm/bn_mp_or.o \ | |
119 | ltm/bn_mp_prime_fermat.o ltm/bn_mp_prime_is_divisible.o ltm/bn_mp_prime_is_prime.o ltm/bn_mp_prime_miller_rabin.o \ | |
120 | ltm/bn_mp_prime_next_prime.o ltm/bn_mp_prime_rabin_miller_trials.o ltm/bn_mp_prime_random_ex.o \ | |
121 | ltm/bn_mp_radix_size.o ltm/bn_mp_radix_smap.o ltm/bn_mp_rand.o ltm/bn_mp_read_radix.o ltm/bn_mp_read_signed_bin.o \ | |
122 | ltm/bn_mp_read_unsigned_bin.o ltm/bn_mp_reduce.o ltm/bn_mp_reduce_2k.o ltm/bn_mp_reduce_2k_l.o \ | |
123 | ltm/bn_mp_reduce_2k_setup.o ltm/bn_mp_reduce_2k_setup_l.o ltm/bn_mp_reduce_is_2k.o ltm/bn_mp_reduce_is_2k_l.o \ | |
124 | ltm/bn_mp_init_set.o ltm/bn_mp_init_set_int.o ltm/bn_mp_init_size.o ltm/bn_mp_invmod.o \ | |
125 | ltm/bn_mp_invmod_slow.o ltm/bn_mp_is_square.o ltm/bn_mp_jacobi.o ltm/bn_mp_karatsuba_mul.o \ | |
126 | ltm/bn_mp_karatsuba_sqr.o ltm/bn_mp_lcm.o ltm/bn_mp_lshd.o ltm/bn_mp_mod.o ltm/bn_mp_mod_2d.o \ | |
127 | ltm/bn_mp_mod_d.o ltm/bn_mp_montgomery_calc_normalization.o ltm/bn_mp_montgomery_reduce.o \ | |
128 | ltm/bn_mp_montgomery_setup.o ltm/bn_mp_mul.o ltm/bn_mp_mulmod.o ltm/bn_mp_mul_2.o \ | |
129 | ltm/bn_mp_mul_2d.o ltm/bn_mp_mul_d.o ltm/bn_mp_neg.o ltm/bn_mp_n_root.o ltm/bn_mp_n_root_ex.o \ | |
130 | ltm/bn_mp_or.o ltm/bn_mp_prime_fermat.o ltm/bn_mp_prime_is_divisible.o ltm/bn_mp_prime_is_prime.o \ | |
131 | ltm/bn_mp_prime_miller_rabin.o ltm/bn_mp_prime_next_prime.o ltm/bn_mp_prime_rabin_miller_trials.o \ | |
132 | ltm/bn_mp_prime_random_ex.o ltm/bn_mp_radix_size.o ltm/bn_mp_radix_smap.o ltm/bn_mp_rand.o \ | |
133 | ltm/bn_mp_read_radix.o ltm/bn_mp_read_signed_bin.o ltm/bn_mp_read_unsigned_bin.o \ | |
134 | ltm/bn_mp_reduce.o ltm/bn_mp_reduce_2k.o ltm/bn_mp_reduce_2k_l.o ltm/bn_mp_reduce_2k_setup.o \ | |
135 | ltm/bn_mp_reduce_2k_setup_l.o ltm/bn_mp_reduce_is_2k.o ltm/bn_mp_reduce_is_2k_l.o \ | |
124 | 136 | ltm/bn_mp_reduce_setup.o ltm/bn_mp_rshd.o ltm/bn_mp_set.o ltm/bn_mp_set_int.o ltm/bn_mp_set_long.o \ |
125 | ltm/bn_mp_set_long_long.o ltm/bn_mp_shrink.o ltm/bn_mp_signed_bin_size.o ltm/bn_mp_sqr.o ltm/bn_mp_sqrmod.o \ | |
126 | ltm/bn_mp_sqrt.o ltm/bn_mp_sqrtmod_prime.o ltm/bn_mp_sub.o ltm/bn_mp_sub_d.o ltm/bn_mp_submod.o \ | |
127 | ltm/bn_mp_to_signed_bin.o ltm/bn_mp_to_signed_bin_n.o ltm/bn_mp_to_unsigned_bin.o ltm/bn_mp_to_unsigned_bin_n.o \ | |
128 | ltm/bn_mp_toom_mul.o ltm/bn_mp_toom_sqr.o ltm/bn_mp_toradix.o ltm/bn_mp_toradix_n.o ltm/bn_mp_unsigned_bin_size.o \ | |
129 | ltm/bn_mp_xor.o ltm/bn_mp_zero.o ltm/bn_prime_tab.o ltm/bn_reverse.o ltm/bn_s_mp_add.o ltm/bn_s_mp_exptmod.o \ | |
130 | ltm/bn_s_mp_mul_digs.o ltm/bn_s_mp_mul_high_digs.o ltm/bn_s_mp_sqr.o ltm/bn_s_mp_sub.o ltm/bncore.o | |
137 | ltm/bn_mp_set_long_long.o ltm/bn_mp_shrink.o ltm/bn_mp_signed_bin_size.o ltm/bn_mp_sqr.o \ | |
138 | ltm/bn_mp_sqrmod.o ltm/bn_mp_sqrt.o ltm/bn_mp_sqrtmod_prime.o ltm/bn_mp_sub.o ltm/bn_mp_submod.o \ | |
139 | ltm/bn_mp_sub_d.o ltm/bn_mp_toom_mul.o ltm/bn_mp_toom_sqr.o ltm/bn_mp_toradix.o ltm/bn_mp_toradix_n.o \ | |
140 | ltm/bn_mp_to_signed_bin.o ltm/bn_mp_to_signed_bin_n.o ltm/bn_mp_to_unsigned_bin.o \ | |
141 | ltm/bn_mp_to_unsigned_bin_n.o ltm/bn_mp_unsigned_bin_size.o ltm/bn_mp_xor.o ltm/bn_mp_zero.o \ | |
142 | ltm/bn_prime_tab.o ltm/bn_reverse.o ltm/bn_s_mp_add.o ltm/bn_s_mp_exptmod.o ltm/bn_s_mp_mul_digs.o \ | |
143 | ltm/bn_s_mp_mul_high_digs.o ltm/bn_s_mp_sqr.o ltm/bn_s_mp_sub.o | |
131 | 144 | |
132 | 145 | LIB_EXT =.a |
133 | 146 | OBJ_EXT =.o |
0 | OBJS=ltc/ciphers/aes/aes.obj ltc/ciphers/anubis.obj ltc/ciphers/blowfish.obj ltc/ciphers/camellia.obj ltc/ciphers/cast5.obj \ | |
1 | ltc/ciphers/des.obj ltc/ciphers/kasumi.obj ltc/ciphers/khazad.obj ltc/ciphers/kseed.obj ltc/ciphers/multi2.obj \ | |
2 | ltc/ciphers/noekeon.obj ltc/ciphers/rc2.obj ltc/ciphers/rc5.obj ltc/ciphers/rc6.obj ltc/ciphers/safer/safer.obj \ | |
3 | ltc/ciphers/safer/saferp.obj ltc/ciphers/skipjack.obj ltc/ciphers/twofish/twofish.obj ltc/ciphers/xtea.obj \ | |
4 | ltc/stream/chacha/chacha_crypt.obj ltc/stream/chacha/chacha_done.obj ltc/stream/chacha/chacha_ivctr32.obj \ | |
5 | ltc/stream/chacha/chacha_ivctr64.obj ltc/stream/chacha/chacha_keystream.obj ltc/stream/chacha/chacha_setup.obj \ | |
6 | ltc/stream/rc4/rc4.obj ltc/stream/sober128/sober128.obj \ | |
7 | ltc/encauth/chachapoly/chacha20poly1305_add_aad.obj ltc/encauth/chachapoly/chacha20poly1305_decrypt.obj \ | |
8 | ltc/encauth/chachapoly/chacha20poly1305_done.obj ltc/encauth/chachapoly/chacha20poly1305_encrypt.obj \ | |
0 | OBJS=ltc/ciphers/anubis.obj ltc/ciphers/blowfish.obj ltc/ciphers/camellia.obj ltc/ciphers/cast5.obj \ | |
1 | ltc/ciphers/des.obj ltc/ciphers/kasumi.obj ltc/ciphers/khazad.obj ltc/ciphers/kseed.obj \ | |
2 | ltc/ciphers/multi2.obj ltc/ciphers/noekeon.obj ltc/ciphers/rc2.obj ltc/ciphers/rc5.obj \ | |
3 | ltc/ciphers/rc6.obj ltc/ciphers/skipjack.obj ltc/ciphers/xtea.obj ltc/ciphers/aes/aes.obj \ | |
4 | ltc/ciphers/safer/safer.obj ltc/ciphers/safer/saferp.obj ltc/ciphers/twofish/twofish.obj \ | |
5 | ltc/encauth/ccm/ccm_add_aad.obj ltc/encauth/ccm/ccm_add_nonce.obj ltc/encauth/ccm/ccm_done.obj \ | |
6 | ltc/encauth/ccm/ccm_init.obj ltc/encauth/ccm/ccm_memory.obj ltc/encauth/ccm/ccm_process.obj \ | |
7 | ltc/encauth/ccm/ccm_reset.obj ltc/encauth/chachapoly/chacha20poly1305_add_aad.obj \ | |
8 | ltc/encauth/chachapoly/chacha20poly1305_decrypt.obj ltc/encauth/chachapoly/chacha20poly1305_done.obj \ | |
9 | ltc/encauth/chachapoly/chacha20poly1305_encrypt.obj ltc/encauth/chachapoly/chacha20poly1305_inciv.obj \ | |
9 | 10 | ltc/encauth/chachapoly/chacha20poly1305_init.obj ltc/encauth/chachapoly/chacha20poly1305_memory.obj \ |
10 | 11 | ltc/encauth/chachapoly/chacha20poly1305_setiv.obj ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.obj \ |
11 | ltc/encauth/chachapoly/chacha20poly1305_inciv.obj \ | |
12 | ltc/encauth/ccm/ccm_add_aad.obj ltc/encauth/ccm/ccm_add_nonce.obj ltc/encauth/ccm/ccm_done.obj ltc/encauth/ccm/ccm_init.obj \ | |
13 | ltc/encauth/ccm/ccm_memory.obj ltc/encauth/ccm/ccm_process.obj ltc/encauth/ccm/ccm_reset.obj \ | |
14 | 12 | ltc/encauth/eax/eax_addheader.obj ltc/encauth/eax/eax_decrypt.obj ltc/encauth/eax/eax_decrypt_verify_memory.obj \ |
15 | 13 | ltc/encauth/eax/eax_done.obj ltc/encauth/eax/eax_encrypt.obj ltc/encauth/eax/eax_encrypt_authenticate_memory.obj \ |
16 | ltc/encauth/eax/eax_init.obj ltc/encauth/gcm/gcm_add_aad.obj ltc/encauth/gcm/gcm_add_iv.obj ltc/encauth/gcm/gcm_done.obj \ | |
17 | ltc/encauth/gcm/gcm_gf_mult.obj ltc/encauth/gcm/gcm_init.obj ltc/encauth/gcm/gcm_memory.obj ltc/encauth/gcm/gcm_mult_h.obj \ | |
18 | ltc/encauth/gcm/gcm_process.obj ltc/encauth/gcm/gcm_reset.obj ltc/encauth/ocb3/ocb3_add_aad.obj \ | |
19 | ltc/encauth/ocb3/ocb3_decrypt.obj ltc/encauth/ocb3/ocb3_decrypt_last.obj ltc/encauth/ocb3/ocb3_decrypt_verify_memory.obj \ | |
14 | ltc/encauth/eax/eax_init.obj ltc/encauth/gcm/gcm_add_aad.obj ltc/encauth/gcm/gcm_add_iv.obj \ | |
15 | ltc/encauth/gcm/gcm_done.obj ltc/encauth/gcm/gcm_gf_mult.obj ltc/encauth/gcm/gcm_init.obj \ | |
16 | ltc/encauth/gcm/gcm_memory.obj ltc/encauth/gcm/gcm_mult_h.obj ltc/encauth/gcm/gcm_process.obj \ | |
17 | ltc/encauth/gcm/gcm_reset.obj ltc/encauth/ocb3/ocb3_add_aad.obj ltc/encauth/ocb3/ocb3_decrypt.obj \ | |
18 | ltc/encauth/ocb3/ocb3_decrypt_last.obj ltc/encauth/ocb3/ocb3_decrypt_verify_memory.obj \ | |
20 | 19 | ltc/encauth/ocb3/ocb3_done.obj ltc/encauth/ocb3/ocb3_encrypt.obj ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.obj \ |
21 | 20 | ltc/encauth/ocb3/ocb3_encrypt_last.obj ltc/encauth/ocb3/ocb3_init.obj ltc/encauth/ocb3/ocb3_int_aad_add_block.obj \ |
22 | ltc/encauth/ocb3/ocb3_int_calc_offset_zero.obj ltc/encauth/ocb3/ocb3_int_ntz.obj ltc/encauth/ocb3/ocb3_int_xor_blocks.obj \ | |
23 | ltc/hashes/chc/chc.obj ltc/hashes/helper/hash_file.obj ltc/hashes/helper/hash_filehandle.obj ltc/hashes/helper/hash_memory.obj \ | |
24 | ltc/hashes/helper/hash_memory_multi.obj ltc/hashes/md2.obj ltc/hashes/md4.obj ltc/hashes/md5.obj ltc/hashes/rmd128.obj \ | |
25 | ltc/hashes/rmd160.obj ltc/hashes/rmd256.obj ltc/hashes/rmd320.obj ltc/hashes/sha1.obj ltc/hashes/sha2/sha224.obj \ | |
26 | ltc/hashes/sha2/sha256.obj ltc/hashes/sha2/sha384.obj ltc/hashes/sha2/sha512.obj ltc/hashes/sha2/sha512_224.obj \ | |
27 | ltc/hashes/sha2/sha512_256.obj ltc/hashes/tiger.obj ltc/hashes/whirl/whirl.obj ltc/hashes/sha3.obj ltc/hashes/sha3_test.obj \ | |
28 | ltc/mac/poly1305/poly1305.obj ltc/mac/poly1305/poly1305_file.obj ltc/mac/poly1305/poly1305_memory.obj ltc/mac/poly1305/poly1305_memory_multi.obj \ | |
29 | ltc/mac/f9/f9_done.obj ltc/mac/f9/f9_file.obj ltc/mac/f9/f9_init.obj ltc/mac/f9/f9_memory.obj ltc/mac/f9/f9_memory_multi.obj ltc/mac/f9/f9_process.obj \ | |
30 | ltc/mac/hmac/hmac_done.obj ltc/mac/hmac/hmac_file.obj ltc/mac/hmac/hmac_init.obj ltc/mac/hmac/hmac_memory.obj \ | |
31 | ltc/mac/hmac/hmac_memory_multi.obj ltc/mac/hmac/hmac_process.obj ltc/mac/omac/omac_done.obj ltc/mac/omac/omac_file.obj \ | |
32 | ltc/mac/omac/omac_init.obj ltc/mac/omac/omac_memory.obj ltc/mac/omac/omac_memory_multi.obj ltc/mac/omac/omac_process.obj \ | |
33 | ltc/mac/pelican/pelican.obj ltc/mac/pelican/pelican_memory.obj ltc/mac/pmac/pmac_done.obj ltc/mac/pmac/pmac_file.obj \ | |
34 | ltc/mac/pmac/pmac_init.obj ltc/mac/pmac/pmac_memory.obj ltc/mac/pmac/pmac_memory_multi.obj ltc/mac/pmac/pmac_ntz.obj \ | |
35 | ltc/mac/pmac/pmac_process.obj ltc/mac/pmac/pmac_shift_xor.obj ltc/mac/xcbc/xcbc_done.obj ltc/mac/xcbc/xcbc_file.obj \ | |
36 | ltc/mac/xcbc/xcbc_init.obj ltc/mac/xcbc/xcbc_memory.obj ltc/mac/xcbc/xcbc_memory_multi.obj ltc/mac/xcbc/xcbc_process.obj \ | |
37 | ltc/math/fp/ltc_ecc_fp_mulmod.obj ltc/math/ltm_desc.obj ltc/math/multi.obj ltc/math/rand_bn.obj ltc/math/rand_prime.obj \ | |
38 | ltc/math/tfm_desc.obj ltc/misc/crc32.obj ltc/misc/adler32.obj ltc/misc/base64/base64_decode.obj ltc/misc/base64/base64_encode.obj ltc/misc/burn_stack.obj \ | |
21 | ltc/encauth/ocb3/ocb3_int_calc_offset_zero.obj ltc/encauth/ocb3/ocb3_int_ntz.obj \ | |
22 | ltc/encauth/ocb3/ocb3_int_xor_blocks.obj ltc/hashes/blake2b.obj ltc/hashes/blake2s.obj \ | |
23 | ltc/hashes/md2.obj ltc/hashes/md4.obj ltc/hashes/md5.obj ltc/hashes/rmd128.obj ltc/hashes/rmd160.obj \ | |
24 | ltc/hashes/rmd256.obj ltc/hashes/rmd320.obj ltc/hashes/sha1.obj ltc/hashes/sha3.obj \ | |
25 | ltc/hashes/sha3_test.obj ltc/hashes/tiger.obj ltc/hashes/chc/chc.obj ltc/hashes/helper/hash_file.obj \ | |
26 | ltc/hashes/helper/hash_filehandle.obj ltc/hashes/helper/hash_memory.obj ltc/hashes/helper/hash_memory_multi.obj \ | |
27 | ltc/hashes/sha2/sha224.obj ltc/hashes/sha2/sha256.obj ltc/hashes/sha2/sha384.obj \ | |
28 | ltc/hashes/sha2/sha512.obj ltc/hashes/sha2/sha512_224.obj ltc/hashes/sha2/sha512_256.obj \ | |
29 | ltc/hashes/whirl/whirl.obj ltc/mac/blake2/blake2bmac.obj ltc/mac/blake2/blake2bmac_file.obj \ | |
30 | ltc/mac/blake2/blake2bmac_memory.obj ltc/mac/blake2/blake2bmac_memory_multi.obj ltc/mac/blake2/blake2smac.obj \ | |
31 | ltc/mac/blake2/blake2smac_file.obj ltc/mac/blake2/blake2smac_memory.obj ltc/mac/blake2/blake2smac_memory_multi.obj \ | |
32 | ltc/mac/f9/f9_done.obj ltc/mac/f9/f9_file.obj ltc/mac/f9/f9_init.obj ltc/mac/f9/f9_memory.obj \ | |
33 | ltc/mac/f9/f9_memory_multi.obj ltc/mac/f9/f9_process.obj ltc/mac/hmac/hmac_done.obj \ | |
34 | ltc/mac/hmac/hmac_file.obj ltc/mac/hmac/hmac_init.obj ltc/mac/hmac/hmac_memory.obj \ | |
35 | ltc/mac/hmac/hmac_memory_multi.obj ltc/mac/hmac/hmac_process.obj ltc/mac/omac/omac_done.obj \ | |
36 | ltc/mac/omac/omac_file.obj ltc/mac/omac/omac_init.obj ltc/mac/omac/omac_memory.obj \ | |
37 | ltc/mac/omac/omac_memory_multi.obj ltc/mac/omac/omac_process.obj ltc/mac/pelican/pelican.obj \ | |
38 | ltc/mac/pelican/pelican_memory.obj ltc/mac/pmac/pmac_done.obj ltc/mac/pmac/pmac_file.obj \ | |
39 | ltc/mac/pmac/pmac_init.obj ltc/mac/pmac/pmac_memory.obj ltc/mac/pmac/pmac_memory_multi.obj \ | |
40 | ltc/mac/pmac/pmac_ntz.obj ltc/mac/pmac/pmac_process.obj ltc/mac/pmac/pmac_shift_xor.obj \ | |
41 | ltc/mac/poly1305/poly1305.obj ltc/mac/poly1305/poly1305_file.obj ltc/mac/poly1305/poly1305_memory.obj \ | |
42 | ltc/mac/poly1305/poly1305_memory_multi.obj ltc/mac/xcbc/xcbc_done.obj ltc/mac/xcbc/xcbc_file.obj \ | |
43 | ltc/mac/xcbc/xcbc_init.obj ltc/mac/xcbc/xcbc_memory.obj ltc/mac/xcbc/xcbc_memory_multi.obj \ | |
44 | ltc/mac/xcbc/xcbc_process.obj ltc/math/ltm_desc.obj ltc/math/multi.obj ltc/math/rand_bn.obj \ | |
45 | ltc/math/rand_prime.obj ltc/math/tfm_desc.obj ltc/math/fp/ltc_ecc_fp_mulmod.obj ltc/misc/adler32.obj \ | |
46 | ltc/misc/burn_stack.obj ltc/misc/crc32.obj ltc/misc/error_to_string.obj ltc/misc/mem_neq.obj \ | |
47 | ltc/misc/pk_get_oid.obj ltc/misc/zeromem.obj ltc/misc/base64/base64_decode.obj ltc/misc/base64/base64_encode.obj \ | |
39 | 48 | ltc/misc/crypt/crypt.obj ltc/misc/crypt/crypt_argchk.obj ltc/misc/crypt/crypt_cipher_descriptor.obj \ |
40 | 49 | ltc/misc/crypt/crypt_cipher_is_valid.obj ltc/misc/crypt/crypt_find_cipher.obj ltc/misc/crypt/crypt_find_cipher_any.obj \ |
41 | 50 | ltc/misc/crypt/crypt_find_cipher_id.obj ltc/misc/crypt/crypt_find_hash.obj ltc/misc/crypt/crypt_find_hash_any.obj \ |
43 | 52 | ltc/misc/crypt/crypt_fsa.obj ltc/misc/crypt/crypt_hash_descriptor.obj ltc/misc/crypt/crypt_hash_is_valid.obj \ |
44 | 53 | ltc/misc/crypt/crypt_inits.obj ltc/misc/crypt/crypt_ltc_mp_descriptor.obj ltc/misc/crypt/crypt_prng_descriptor.obj \ |
45 | 54 | ltc/misc/crypt/crypt_prng_is_valid.obj ltc/misc/crypt/crypt_register_cipher.obj ltc/misc/crypt/crypt_register_hash.obj \ |
46 | ltc/misc/crypt/crypt_register_prng.obj ltc/misc/crypt/crypt_unregister_cipher.obj ltc/misc/crypt/crypt_unregister_hash.obj \ | |
47 | ltc/misc/crypt/crypt_unregister_prng.obj ltc/misc/error_to_string.obj ltc/misc/hkdf/hkdf.obj ltc/misc/mem_neq.obj \ | |
48 | ltc/misc/pkcs5/pkcs_5_1.obj ltc/misc/pkcs5/pkcs_5_2.obj ltc/misc/pk_get_oid.obj ltc/misc/zeromem.obj \ | |
49 | ltc/modes/cbc/cbc_decrypt.obj ltc/modes/cbc/cbc_done.obj ltc/modes/cbc/cbc_encrypt.obj ltc/modes/cbc/cbc_getiv.obj \ | |
50 | ltc/modes/cbc/cbc_setiv.obj ltc/modes/cbc/cbc_start.obj ltc/modes/cfb/cfb_decrypt.obj ltc/modes/cfb/cfb_done.obj \ | |
51 | ltc/modes/cfb/cfb_encrypt.obj ltc/modes/cfb/cfb_getiv.obj ltc/modes/cfb/cfb_setiv.obj ltc/modes/cfb/cfb_start.obj \ | |
52 | ltc/modes/ctr/ctr_decrypt.obj ltc/modes/ctr/ctr_done.obj ltc/modes/ctr/ctr_encrypt.obj ltc/modes/ctr/ctr_getiv.obj \ | |
53 | ltc/modes/ctr/ctr_setiv.obj ltc/modes/ctr/ctr_start.obj ltc/modes/ecb/ecb_decrypt.obj ltc/modes/ecb/ecb_done.obj \ | |
54 | ltc/modes/ecb/ecb_encrypt.obj ltc/modes/ecb/ecb_start.obj ltc/modes/ofb/ofb_decrypt.obj ltc/modes/ofb/ofb_done.obj \ | |
55 | ltc/modes/ofb/ofb_encrypt.obj ltc/modes/ofb/ofb_getiv.obj ltc/modes/ofb/ofb_setiv.obj ltc/modes/ofb/ofb_start.obj \ | |
55 | ltc/misc/crypt/crypt_register_prng.obj ltc/misc/crypt/crypt_unregister_cipher.obj \ | |
56 | ltc/misc/crypt/crypt_unregister_hash.obj ltc/misc/crypt/crypt_unregister_prng.obj \ | |
57 | ltc/misc/hkdf/hkdf.obj ltc/misc/pkcs5/pkcs_5_1.obj ltc/misc/pkcs5/pkcs_5_2.obj ltc/modes/cbc/cbc_decrypt.obj \ | |
58 | ltc/modes/cbc/cbc_done.obj ltc/modes/cbc/cbc_encrypt.obj ltc/modes/cbc/cbc_getiv.obj \ | |
59 | ltc/modes/cbc/cbc_setiv.obj ltc/modes/cbc/cbc_start.obj ltc/modes/cfb/cfb_decrypt.obj \ | |
60 | ltc/modes/cfb/cfb_done.obj ltc/modes/cfb/cfb_encrypt.obj ltc/modes/cfb/cfb_getiv.obj \ | |
61 | ltc/modes/cfb/cfb_setiv.obj ltc/modes/cfb/cfb_start.obj ltc/modes/ctr/ctr_decrypt.obj \ | |
62 | ltc/modes/ctr/ctr_done.obj ltc/modes/ctr/ctr_encrypt.obj ltc/modes/ctr/ctr_getiv.obj \ | |
63 | ltc/modes/ctr/ctr_setiv.obj ltc/modes/ctr/ctr_start.obj ltc/modes/ecb/ecb_decrypt.obj \ | |
64 | ltc/modes/ecb/ecb_done.obj ltc/modes/ecb/ecb_encrypt.obj ltc/modes/ecb/ecb_start.obj \ | |
65 | ltc/modes/ofb/ofb_decrypt.obj ltc/modes/ofb/ofb_done.obj ltc/modes/ofb/ofb_encrypt.obj \ | |
66 | ltc/modes/ofb/ofb_getiv.obj ltc/modes/ofb/ofb_setiv.obj ltc/modes/ofb/ofb_start.obj \ | |
56 | 67 | ltc/pk/asn1/der/bit/der_decode_bit_string.obj ltc/pk/asn1/der/bit/der_decode_raw_bit_string.obj \ |
57 | 68 | ltc/pk/asn1/der/bit/der_encode_bit_string.obj ltc/pk/asn1/der/bit/der_encode_raw_bit_string.obj \ |
58 | 69 | ltc/pk/asn1/der/bit/der_length_bit_string.obj ltc/pk/asn1/der/boolean/der_decode_boolean.obj \ |
59 | 70 | ltc/pk/asn1/der/boolean/der_encode_boolean.obj ltc/pk/asn1/der/boolean/der_length_boolean.obj \ |
60 | ltc/pk/asn1/der/choice/der_decode_choice.obj ltc/pk/asn1/der/ia5/der_decode_ia5_string.obj \ | |
61 | ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.obj ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.obj \ | |
62 | ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.obj \ | |
63 | ltc/pk/asn1/der/ia5/der_encode_ia5_string.obj ltc/pk/asn1/der/ia5/der_length_ia5_string.obj \ | |
64 | ltc/pk/asn1/der/integer/der_decode_integer.obj ltc/pk/asn1/der/integer/der_encode_integer.obj \ | |
65 | ltc/pk/asn1/der/integer/der_length_integer.obj ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.obj \ | |
66 | ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.obj \ | |
71 | ltc/pk/asn1/der/choice/der_decode_choice.obj ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.obj \ | |
72 | ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.obj ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.obj \ | |
73 | ltc/pk/asn1/der/ia5/der_decode_ia5_string.obj ltc/pk/asn1/der/ia5/der_encode_ia5_string.obj \ | |
74 | ltc/pk/asn1/der/ia5/der_length_ia5_string.obj ltc/pk/asn1/der/integer/der_decode_integer.obj \ | |
75 | ltc/pk/asn1/der/integer/der_encode_integer.obj ltc/pk/asn1/der/integer/der_length_integer.obj \ | |
76 | ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.obj ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.obj \ | |
67 | 77 | ltc/pk/asn1/der/object_identifier/der_length_object_identifier.obj ltc/pk/asn1/der/octet/der_decode_octet_string.obj \ |
68 | 78 | ltc/pk/asn1/der/octet/der_encode_octet_string.obj ltc/pk/asn1/der/octet/der_length_octet_string.obj \ |
69 | ltc/pk/asn1/der/printable_string/der_decode_printable_string.obj \ | |
70 | ltc/pk/asn1/der/printable_string/der_encode_printable_string.obj \ | |
79 | ltc/pk/asn1/der/printable_string/der_decode_printable_string.obj ltc/pk/asn1/der/printable_string/der_encode_printable_string.obj \ | |
71 | 80 | ltc/pk/asn1/der/printable_string/der_length_printable_string.obj ltc/pk/asn1/der/sequence/der_decode_sequence_ex.obj \ |
72 | 81 | ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.obj ltc/pk/asn1/der/sequence/der_decode_sequence_multi.obj \ |
73 | 82 | ltc/pk/asn1/der/sequence/der_decode_subject_public_key_info.obj ltc/pk/asn1/der/sequence/der_encode_sequence_ex.obj \ |
74 | 83 | ltc/pk/asn1/der/sequence/der_encode_sequence_multi.obj ltc/pk/asn1/der/sequence/der_encode_subject_public_key_info.obj \ |
75 | 84 | ltc/pk/asn1/der/sequence/der_length_sequence.obj ltc/pk/asn1/der/sequence/der_sequence_free.obj \ |
76 | ltc/pk/asn1/der/set/der_encode_set.obj ltc/pk/asn1/der/set/der_encode_setof.obj \ | |
77 | ltc/pk/asn1/der/short_integer/der_decode_short_integer.obj ltc/pk/asn1/der/short_integer/der_encode_short_integer.obj \ | |
78 | ltc/pk/asn1/der/short_integer/der_length_short_integer.obj ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.obj \ | |
79 | ltc/pk/asn1/der/teletex_string/der_length_teletex_string.obj ltc/pk/asn1/der/utctime/der_decode_utctime.obj \ | |
80 | ltc/pk/asn1/der/utctime/der_encode_utctime.obj ltc/pk/asn1/der/utctime/der_length_utctime.obj \ | |
81 | ltc/pk/asn1/der/utf8/der_decode_utf8_string.obj ltc/pk/asn1/der/utf8/der_encode_utf8_string.obj \ | |
82 | ltc/pk/asn1/der/utf8/der_length_utf8_string.obj ltc/pk/dh/dh.obj ltc/pk/dh/dh_static.obj ltc/pk/dh/dh_sys.obj \ | |
83 | ltc/pk/dsa/dsa_decrypt_key.obj ltc/pk/dsa/dsa_encrypt_key.obj ltc/pk/dsa/dsa_export.obj ltc/pk/dsa/dsa_free.obj \ | |
84 | ltc/pk/dsa/dsa_import.obj ltc/pk/dsa/dsa_import_radix.obj ltc/pk/dsa/dsa_make_key.obj ltc/pk/dsa/dsa_shared_secret.obj \ | |
85 | ltc/pk/dsa/dsa_sign_hash.obj ltc/pk/dsa/dsa_verify_hash.obj ltc/pk/dsa/dsa_verify_key.obj ltc/pk/ecc/ecc.obj \ | |
86 | ltc/pk/ecc/ecc_ansi_x963_export.obj ltc/pk/ecc/ecc_ansi_x963_import.obj ltc/pk/ecc/ecc_decrypt_key.obj \ | |
87 | ltc/pk/ecc/ecc_dp_clear.obj ltc/pk/ecc/ecc_dp_fill_from_sets.obj ltc/pk/ecc/ecc_dp_from_oid.obj \ | |
88 | ltc/pk/ecc/ecc_dp_from_params.obj ltc/pk/ecc/ecc_dp_init.obj ltc/pk/ecc/ecc_dp_set.obj \ | |
89 | ltc/pk/ecc/ecc_encrypt_key.obj ltc/pk/ecc/ecc_export.obj ltc/pk/ecc/ecc_export_full.obj \ | |
90 | ltc/pk/ecc/ecc_export_raw.obj ltc/pk/ecc/ecc_free.obj ltc/pk/ecc/ecc_get_size.obj ltc/pk/ecc/ecc_import.obj \ | |
91 | ltc/pk/ecc/ecc_import_full.obj ltc/pk/ecc/ecc_import_pkcs8.obj ltc/pk/ecc/ecc_import_raw.obj \ | |
92 | ltc/pk/ecc/ecc_make_key.obj ltc/pk/ecc/ecc_shared_secret.obj ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj \ | |
93 | ltc/pk/ecc/ecc_verify_hash.obj ltc/pk/ecc/ecc_verify_key.obj ltc/pk/ecc/ltc_ecc_is_point.obj \ | |
94 | ltc/pk/ecc/ltc_ecc_is_valid_idx.obj ltc/pk/ecc/ltc_ecc_map.obj ltc/pk/ecc/ltc_ecc_mul2add.obj ltc/pk/ecc/ltc_ecc_mulmod.obj \ | |
95 | ltc/pk/ecc/ltc_ecc_mulmod_timing.obj ltc/pk/ecc/ltc_ecc_points.obj ltc/pk/ecc/ltc_ecc_projective_add_point.obj \ | |
96 | ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj ltc/pk/pkcs1/pkcs_1_i2osp.obj ltc/pk/pkcs1/pkcs_1_mgf1.obj \ | |
97 | ltc/pk/ecc/ltc_ecc_export_point.obj ltc/pk/ecc/ltc_ecc_import_point.obj ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj \ | |
98 | ltc/pk/pkcs1/pkcs_1_oaep_decode.obj ltc/pk/pkcs1/pkcs_1_oaep_encode.obj ltc/pk/pkcs1/pkcs_1_os2ip.obj \ | |
99 | ltc/pk/pkcs1/pkcs_1_pss_decode.obj ltc/pk/pkcs1/pkcs_1_pss_encode.obj ltc/pk/pkcs1/pkcs_1_v1_5_decode.obj \ | |
100 | ltc/pk/pkcs1/pkcs_1_v1_5_encode.obj ltc/pk/rsa/rsa_decrypt_key.obj ltc/pk/rsa/rsa_encrypt_key.obj ltc/pk/rsa/rsa_export.obj \ | |
85 | ltc/pk/asn1/der/set/der_encode_set.obj ltc/pk/asn1/der/set/der_encode_setof.obj ltc/pk/asn1/der/short_integer/der_decode_short_integer.obj \ | |
86 | ltc/pk/asn1/der/short_integer/der_encode_short_integer.obj ltc/pk/asn1/der/short_integer/der_length_short_integer.obj \ | |
87 | ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.obj ltc/pk/asn1/der/teletex_string/der_length_teletex_string.obj \ | |
88 | ltc/pk/asn1/der/utctime/der_decode_utctime.obj ltc/pk/asn1/der/utctime/der_encode_utctime.obj \ | |
89 | ltc/pk/asn1/der/utctime/der_length_utctime.obj ltc/pk/asn1/der/utf8/der_decode_utf8_string.obj \ | |
90 | ltc/pk/asn1/der/utf8/der_encode_utf8_string.obj ltc/pk/asn1/der/utf8/der_length_utf8_string.obj \ | |
91 | ltc/pk/dh/dh.obj ltc/pk/dh/dh_static.obj ltc/pk/dh/dh_sys.obj ltc/pk/dsa/dsa_decrypt_key.obj \ | |
92 | ltc/pk/dsa/dsa_encrypt_key.obj ltc/pk/dsa/dsa_export.obj ltc/pk/dsa/dsa_free.obj \ | |
93 | ltc/pk/dsa/dsa_import.obj ltc/pk/dsa/dsa_import_radix.obj ltc/pk/dsa/dsa_make_key.obj \ | |
94 | ltc/pk/dsa/dsa_shared_secret.obj ltc/pk/dsa/dsa_sign_hash.obj ltc/pk/dsa/dsa_verify_hash.obj \ | |
95 | ltc/pk/dsa/dsa_verify_key.obj ltc/pk/ecc/ecc.obj ltc/pk/ecc/ecc_ansi_x963_export.obj \ | |
96 | ltc/pk/ecc/ecc_ansi_x963_import.obj ltc/pk/ecc/ecc_decrypt_key.obj ltc/pk/ecc/ecc_dp_clear.obj \ | |
97 | ltc/pk/ecc/ecc_dp_fill_from_sets.obj ltc/pk/ecc/ecc_dp_from_oid.obj ltc/pk/ecc/ecc_dp_from_params.obj \ | |
98 | ltc/pk/ecc/ecc_dp_init.obj ltc/pk/ecc/ecc_dp_set.obj ltc/pk/ecc/ecc_encrypt_key.obj \ | |
99 | ltc/pk/ecc/ecc_export.obj ltc/pk/ecc/ecc_export_full.obj ltc/pk/ecc/ecc_export_raw.obj \ | |
100 | ltc/pk/ecc/ecc_free.obj ltc/pk/ecc/ecc_get_size.obj ltc/pk/ecc/ecc_import.obj ltc/pk/ecc/ecc_import_full.obj \ | |
101 | ltc/pk/ecc/ecc_import_pkcs8.obj ltc/pk/ecc/ecc_import_raw.obj ltc/pk/ecc/ecc_make_key.obj \ | |
102 | ltc/pk/ecc/ecc_shared_secret.obj ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj \ | |
103 | ltc/pk/ecc/ecc_verify_hash.obj ltc/pk/ecc/ecc_verify_key.obj ltc/pk/ecc/ltc_ecc_export_point.obj \ | |
104 | ltc/pk/ecc/ltc_ecc_import_point.obj ltc/pk/ecc/ltc_ecc_is_point.obj ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj \ | |
105 | ltc/pk/ecc/ltc_ecc_is_valid_idx.obj ltc/pk/ecc/ltc_ecc_map.obj ltc/pk/ecc/ltc_ecc_mul2add.obj \ | |
106 | ltc/pk/ecc/ltc_ecc_mulmod.obj ltc/pk/ecc/ltc_ecc_mulmod_timing.obj ltc/pk/ecc/ltc_ecc_points.obj \ | |
107 | ltc/pk/ecc/ltc_ecc_projective_add_point.obj ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj \ | |
108 | ltc/pk/pkcs1/pkcs_1_i2osp.obj ltc/pk/pkcs1/pkcs_1_mgf1.obj ltc/pk/pkcs1/pkcs_1_oaep_decode.obj \ | |
109 | ltc/pk/pkcs1/pkcs_1_oaep_encode.obj ltc/pk/pkcs1/pkcs_1_os2ip.obj ltc/pk/pkcs1/pkcs_1_pss_decode.obj \ | |
110 | ltc/pk/pkcs1/pkcs_1_pss_encode.obj ltc/pk/pkcs1/pkcs_1_v1_5_decode.obj ltc/pk/pkcs1/pkcs_1_v1_5_encode.obj \ | |
111 | ltc/pk/rsa/rsa_decrypt_key.obj ltc/pk/rsa/rsa_encrypt_key.obj ltc/pk/rsa/rsa_export.obj \ | |
101 | 112 | ltc/pk/rsa/rsa_exptmod.obj ltc/pk/rsa/rsa_free.obj ltc/pk/rsa/rsa_get_size.obj ltc/pk/rsa/rsa_import.obj \ |
102 | ltc/pk/rsa/rsa_import_radix.obj ltc/pk/rsa/rsa_import_pkcs8.obj ltc/pk/rsa/rsa_import_x509.obj ltc/pk/rsa/rsa_make_key.obj ltc/pk/rsa/rsa_sign_hash.obj \ | |
103 | ltc/pk/rsa/rsa_sign_saltlen_get.obj ltc/pk/rsa/rsa_verify_hash.obj ltc/prngs/fortuna.obj ltc/prngs/rc4.obj \ | |
104 | ltc/prngs/rng_get_bytes.obj ltc/prngs/rng_make_prng.obj ltc/prngs/sober128.obj ltc/prngs/sprng.obj ltc/prngs/yarrow.obj ltc/prngs/chacha20.obj \ | |
105 | ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj ltm/bn_fast_mp_montgomery_reduce.obj ltm/bn_fast_s_mp_mul_digs.obj \ | |
106 | ltm/bn_fast_s_mp_mul_high_digs.obj ltm/bn_fast_s_mp_sqr.obj ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj ltm/bn_mp_add.obj \ | |
107 | ltm/bn_mp_add_d.obj ltm/bn_mp_addmod.obj ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj ltm/bn_mp_clear.obj ltm/bn_mp_clear_multi.obj \ | |
108 | ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj ltm/bn_mp_cmp_mag.obj ltm/bn_mp_cnt_lsb.obj ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj \ | |
109 | ltm/bn_mp_div.obj ltm/bn_mp_div_2.obj ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj ltm/bn_mp_dr_is_modulus.obj \ | |
110 | ltm/bn_mp_dr_reduce.obj ltm/bn_mp_dr_setup.obj ltm/bn_mp_exch.obj ltm/bn_mp_export.obj ltm/bn_mp_expt_d.obj \ | |
111 | ltm/bn_mp_expt_d_ex.obj ltm/bn_mp_exptmod.obj ltm/bn_mp_exptmod_fast.obj ltm/bn_mp_exteuclid.obj ltm/bn_mp_fread.obj \ | |
112 | ltm/bn_mp_fwrite.obj ltm/bn_mp_gcd.obj ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj ltm/bn_mp_get_long_long.obj \ | |
113 | ltm/bn_mp_grow.obj ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj ltm/bn_mp_init_multi.obj \ | |
114 | ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj ltm/bn_mp_invmod.obj ltm/bn_mp_invmod_slow.obj \ | |
115 | ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj ltm/bn_mp_karatsuba_mul.obj ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_lcm.obj \ | |
116 | ltm/bn_mp_lshd.obj ltm/bn_mp_mod.obj ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \ | |
117 | ltm/bn_mp_montgomery_reduce.obj ltm/bn_mp_montgomery_setup.obj ltm/bn_mp_mul.obj ltm/bn_mp_mul_2.obj ltm/bn_mp_mul_2d.obj \ | |
118 | ltm/bn_mp_mul_d.obj ltm/bn_mp_mulmod.obj ltm/bn_mp_n_root.obj ltm/bn_mp_n_root_ex.obj ltm/bn_mp_neg.obj ltm/bn_mp_or.obj \ | |
119 | ltm/bn_mp_prime_fermat.obj ltm/bn_mp_prime_is_divisible.obj ltm/bn_mp_prime_is_prime.obj ltm/bn_mp_prime_miller_rabin.obj \ | |
113 | ltc/pk/rsa/rsa_import_pkcs8.obj ltc/pk/rsa/rsa_import_radix.obj ltc/pk/rsa/rsa_import_x509.obj \ | |
114 | ltc/pk/rsa/rsa_make_key.obj ltc/pk/rsa/rsa_sign_hash.obj ltc/pk/rsa/rsa_sign_saltlen_get.obj \ | |
115 | ltc/pk/rsa/rsa_verify_hash.obj ltc/prngs/chacha20.obj ltc/prngs/fortuna.obj ltc/prngs/rc4.obj \ | |
116 | ltc/prngs/rng_get_bytes.obj ltc/prngs/rng_make_prng.obj ltc/prngs/sober128.obj ltc/prngs/sprng.obj \ | |
117 | ltc/prngs/yarrow.obj ltc/stream/chacha/chacha_crypt.obj ltc/stream/chacha/chacha_done.obj \ | |
118 | ltc/stream/chacha/chacha_ivctr32.obj ltc/stream/chacha/chacha_ivctr64.obj ltc/stream/chacha/chacha_keystream.obj \ | |
119 | ltc/stream/chacha/chacha_setup.obj ltc/stream/rc4/rc4.obj ltc/stream/sober128/sober128.obj \ | |
120 | ltm/bncore.obj ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj ltm/bn_fast_mp_montgomery_reduce.obj \ | |
121 | ltm/bn_fast_s_mp_mul_digs.obj ltm/bn_fast_s_mp_mul_high_digs.obj ltm/bn_fast_s_mp_sqr.obj \ | |
122 | ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj ltm/bn_mp_add.obj ltm/bn_mp_addmod.obj ltm/bn_mp_add_d.obj \ | |
123 | ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj ltm/bn_mp_clear.obj ltm/bn_mp_clear_multi.obj \ | |
124 | ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj ltm/bn_mp_cmp_mag.obj ltm/bn_mp_cnt_lsb.obj \ | |
125 | ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj ltm/bn_mp_div.obj ltm/bn_mp_div_2.obj \ | |
126 | ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj ltm/bn_mp_dr_is_modulus.obj \ | |
127 | ltm/bn_mp_dr_reduce.obj ltm/bn_mp_dr_setup.obj ltm/bn_mp_exch.obj ltm/bn_mp_export.obj \ | |
128 | ltm/bn_mp_exptmod.obj ltm/bn_mp_exptmod_fast.obj ltm/bn_mp_expt_d.obj ltm/bn_mp_expt_d_ex.obj \ | |
129 | ltm/bn_mp_exteuclid.obj ltm/bn_mp_fread.obj ltm/bn_mp_fwrite.obj ltm/bn_mp_gcd.obj \ | |
130 | ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj ltm/bn_mp_get_long_long.obj ltm/bn_mp_grow.obj \ | |
131 | ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj ltm/bn_mp_init_multi.obj \ | |
132 | ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj ltm/bn_mp_invmod.obj \ | |
133 | ltm/bn_mp_invmod_slow.obj ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj ltm/bn_mp_karatsuba_mul.obj \ | |
134 | ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_lcm.obj ltm/bn_mp_lshd.obj ltm/bn_mp_mod.obj \ | |
135 | ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \ | |
136 | ltm/bn_mp_montgomery_reduce.obj ltm/bn_mp_montgomery_setup.obj ltm/bn_mp_mul.obj \ | |
137 | ltm/bn_mp_mulmod.obj ltm/bn_mp_mul_2.obj ltm/bn_mp_mul_2d.obj ltm/bn_mp_mul_d.obj \ | |
138 | ltm/bn_mp_neg.obj ltm/bn_mp_n_root.obj ltm/bn_mp_n_root_ex.obj ltm/bn_mp_or.obj ltm/bn_mp_prime_fermat.obj \ | |
139 | ltm/bn_mp_prime_is_divisible.obj ltm/bn_mp_prime_is_prime.obj ltm/bn_mp_prime_miller_rabin.obj \ | |
120 | 140 | ltm/bn_mp_prime_next_prime.obj ltm/bn_mp_prime_rabin_miller_trials.obj ltm/bn_mp_prime_random_ex.obj \ |
121 | ltm/bn_mp_radix_size.obj ltm/bn_mp_radix_smap.obj ltm/bn_mp_rand.obj ltm/bn_mp_read_radix.obj ltm/bn_mp_read_signed_bin.obj \ | |
122 | ltm/bn_mp_read_unsigned_bin.obj ltm/bn_mp_reduce.obj ltm/bn_mp_reduce_2k.obj ltm/bn_mp_reduce_2k_l.obj \ | |
123 | ltm/bn_mp_reduce_2k_setup.obj ltm/bn_mp_reduce_2k_setup_l.obj ltm/bn_mp_reduce_is_2k.obj ltm/bn_mp_reduce_is_2k_l.obj \ | |
124 | ltm/bn_mp_reduce_setup.obj ltm/bn_mp_rshd.obj ltm/bn_mp_set.obj ltm/bn_mp_set_int.obj ltm/bn_mp_set_long.obj \ | |
125 | ltm/bn_mp_set_long_long.obj ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj ltm/bn_mp_sqr.obj ltm/bn_mp_sqrmod.obj \ | |
126 | ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj ltm/bn_mp_sub.obj ltm/bn_mp_sub_d.obj ltm/bn_mp_submod.obj \ | |
127 | ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj ltm/bn_mp_to_unsigned_bin.obj ltm/bn_mp_to_unsigned_bin_n.obj \ | |
128 | ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj ltm/bn_mp_toradix.obj ltm/bn_mp_toradix_n.obj ltm/bn_mp_unsigned_bin_size.obj \ | |
129 | ltm/bn_mp_xor.obj ltm/bn_mp_zero.obj ltm/bn_prime_tab.obj ltm/bn_reverse.obj ltm/bn_s_mp_add.obj ltm/bn_s_mp_exptmod.obj \ | |
130 | ltm/bn_s_mp_mul_digs.obj ltm/bn_s_mp_mul_high_digs.obj ltm/bn_s_mp_sqr.obj ltm/bn_s_mp_sub.obj ltm/bncore.obj | |
141 | ltm/bn_mp_radix_size.obj ltm/bn_mp_radix_smap.obj ltm/bn_mp_rand.obj ltm/bn_mp_read_radix.obj \ | |
142 | ltm/bn_mp_read_signed_bin.obj ltm/bn_mp_read_unsigned_bin.obj ltm/bn_mp_reduce.obj \ | |
143 | ltm/bn_mp_reduce_2k.obj ltm/bn_mp_reduce_2k_l.obj ltm/bn_mp_reduce_2k_setup.obj ltm/bn_mp_reduce_2k_setup_l.obj \ | |
144 | ltm/bn_mp_reduce_is_2k.obj ltm/bn_mp_reduce_is_2k_l.obj ltm/bn_mp_reduce_setup.obj \ | |
145 | ltm/bn_mp_rshd.obj ltm/bn_mp_set.obj ltm/bn_mp_set_int.obj ltm/bn_mp_set_long.obj \ | |
146 | ltm/bn_mp_set_long_long.obj ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj ltm/bn_mp_sqr.obj \ | |
147 | ltm/bn_mp_sqrmod.obj ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj ltm/bn_mp_sub.obj \ | |
148 | ltm/bn_mp_submod.obj ltm/bn_mp_sub_d.obj ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj \ | |
149 | ltm/bn_mp_toradix.obj ltm/bn_mp_toradix_n.obj ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj \ | |
150 | ltm/bn_mp_to_unsigned_bin.obj ltm/bn_mp_to_unsigned_bin_n.obj ltm/bn_mp_unsigned_bin_size.obj \ | |
151 | ltm/bn_mp_xor.obj ltm/bn_mp_zero.obj ltm/bn_prime_tab.obj ltm/bn_reverse.obj ltm/bn_s_mp_add.obj \ | |
152 | ltm/bn_s_mp_exptmod.obj ltm/bn_s_mp_mul_digs.obj ltm/bn_s_mp_mul_high_digs.obj ltm/bn_s_mp_sqr.obj \ | |
153 | ltm/bn_s_mp_sub.obj | |
131 | 154 | |
132 | 155 | PERL =perl |
133 | 156 | RM_F =$(PERL) -MExtUtils::Command -e rm_f -- |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | /* | |
10 | BLAKE2 reference source code package - reference C implementations | |
11 | ||
12 | Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the | |
13 | terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at | |
14 | your option. The terms of these licenses can be found at: | |
15 | ||
16 | - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 | |
17 | - OpenSSL license : https://www.openssl.org/source/license.html | |
18 | - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 | |
19 | ||
20 | More information about the BLAKE2 hash function can be found at | |
21 | https://blake2.net. | |
22 | */ | |
23 | /* see also https://www.ietf.org/rfc/rfc7693.txt */ | |
24 | ||
25 | #include "tomcrypt.h" | |
26 | ||
27 | #ifdef LTC_BLAKE2B | |
28 | ||
29 | enum blake2b_constant { | |
30 | BLAKE2B_BLOCKBYTES = 128, | |
31 | BLAKE2B_OUTBYTES = 64, | |
32 | BLAKE2B_KEYBYTES = 64, | |
33 | BLAKE2B_SALTBYTES = 16, | |
34 | BLAKE2B_PERSONALBYTES = 16, | |
35 | BLAKE2B_PARAM_SIZE = 64 | |
36 | }; | |
37 | ||
38 | /* param offsets */ | |
39 | enum { | |
40 | O_DIGEST_LENGTH = 0, | |
41 | O_KEY_LENGTH = 1, | |
42 | O_FANOUT = 2, | |
43 | O_DEPTH = 3, | |
44 | O_LEAF_LENGTH = 4, | |
45 | O_NODE_OFFSET = 8, | |
46 | O_XOF_LENGTH = 12, | |
47 | O_NODE_DEPTH = 16, | |
48 | O_INNER_LENGTH = 17, | |
49 | O_RESERVED = 18, | |
50 | O_SALT = 32, | |
51 | O_PERSONAL = 48 | |
52 | }; | |
53 | ||
54 | /* | |
55 | struct blake2b_param { | |
56 | unsigned char digest_length; | |
57 | unsigned char key_length; | |
58 | unsigned char fanout; | |
59 | unsigned char depth; | |
60 | ulong32 leaf_length; | |
61 | ulong32 node_offset; | |
62 | ulong32 xof_length; | |
63 | unsigned char node_depth; | |
64 | unsigned char inner_length; | |
65 | unsigned char reserved[14]; | |
66 | unsigned char salt[BLAKE2B_SALTBYTES]; | |
67 | unsigned char personal[BLAKE2B_PERSONALBYTES]; | |
68 | }; | |
69 | */ | |
70 | ||
71 | const struct ltc_hash_descriptor blake2b_160_desc = | |
72 | { | |
73 | "blake2b-160", | |
74 | 25, | |
75 | 20, | |
76 | 128, | |
77 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 1, 5 }, | |
78 | 11, | |
79 | &blake2b_160_init, | |
80 | &blake2b_process, | |
81 | &blake2b_done, | |
82 | &blake2b_160_test, | |
83 | NULL | |
84 | }; | |
85 | ||
86 | const struct ltc_hash_descriptor blake2b_256_desc = | |
87 | { | |
88 | "blake2b-256", | |
89 | 26, | |
90 | 32, | |
91 | 128, | |
92 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 1, 8 }, | |
93 | 11, | |
94 | &blake2b_256_init, | |
95 | &blake2b_process, | |
96 | &blake2b_done, | |
97 | &blake2b_256_test, | |
98 | NULL | |
99 | }; | |
100 | ||
101 | const struct ltc_hash_descriptor blake2b_384_desc = | |
102 | { | |
103 | "blake2b-384", | |
104 | 27, | |
105 | 48, | |
106 | 128, | |
107 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 1, 12 }, | |
108 | 11, | |
109 | &blake2b_384_init, | |
110 | &blake2b_process, | |
111 | &blake2b_done, | |
112 | &blake2b_384_test, | |
113 | NULL | |
114 | }; | |
115 | ||
116 | const struct ltc_hash_descriptor blake2b_512_desc = | |
117 | { | |
118 | "blake2b-512", | |
119 | 28, | |
120 | 64, | |
121 | 128, | |
122 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 1, 16 }, | |
123 | 11, | |
124 | &blake2b_512_init, | |
125 | &blake2b_process, | |
126 | &blake2b_done, | |
127 | &blake2b_512_test, | |
128 | NULL | |
129 | }; | |
130 | ||
131 | static const ulong64 blake2b_IV[8] = | |
132 | { | |
133 | CONST64(0x6a09e667f3bcc908), CONST64(0xbb67ae8584caa73b), | |
134 | CONST64(0x3c6ef372fe94f82b), CONST64(0xa54ff53a5f1d36f1), | |
135 | CONST64(0x510e527fade682d1), CONST64(0x9b05688c2b3e6c1f), | |
136 | CONST64(0x1f83d9abfb41bd6b), CONST64(0x5be0cd19137e2179) | |
137 | }; | |
138 | ||
139 | static const unsigned char blake2b_sigma[12][16] = | |
140 | { | |
141 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , | |
142 | { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , | |
143 | { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , | |
144 | { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , | |
145 | { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , | |
146 | { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , | |
147 | { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , | |
148 | { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , | |
149 | { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , | |
150 | { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , | |
151 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , | |
152 | { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } | |
153 | }; | |
154 | ||
155 | static void blake2b_set_lastnode(hash_state *md) { md->blake2b.f[1] = CONST64(0xffffffffffffffff); } | |
156 | ||
157 | /* Some helper functions, not necessarily useful */ | |
158 | static int blake2b_is_lastblock(const hash_state *md) { return md->blake2b.f[0] != 0; } | |
159 | ||
160 | static void blake2b_set_lastblock(hash_state *md) | |
161 | { | |
162 | if (md->blake2b.last_node) | |
163 | blake2b_set_lastnode(md); | |
164 | ||
165 | md->blake2b.f[0] = CONST64(0xffffffffffffffff); | |
166 | } | |
167 | ||
168 | static void blake2b_increment_counter(hash_state *md, ulong64 inc) | |
169 | { | |
170 | md->blake2b.t[0] += inc; | |
171 | md->blake2b.t[1] += (md->blake2b.t[0] < inc); | |
172 | } | |
173 | ||
174 | static void blake2b_init0(hash_state *md) | |
175 | { | |
176 | unsigned long i; | |
177 | XMEMSET(&md->blake2b, 0, sizeof(md->blake2b)); | |
178 | ||
179 | for (i = 0; i < 8; ++i) | |
180 | md->blake2b.h[i] = blake2b_IV[i]; | |
181 | } | |
182 | ||
183 | /* init xors IV with input parameter block */ | |
184 | static int blake2b_init_param(hash_state *md, const unsigned char *P) | |
185 | { | |
186 | unsigned long i; | |
187 | ||
188 | blake2b_init0(md); | |
189 | ||
190 | /* IV XOR ParamBlock */ | |
191 | for (i = 0; i < 8; ++i) { | |
192 | ulong64 tmp; | |
193 | LOAD64L(tmp, P + i * 8); | |
194 | md->blake2b.h[i] ^= tmp; | |
195 | } | |
196 | ||
197 | md->blake2b.outlen = P[O_DIGEST_LENGTH]; | |
198 | return CRYPT_OK; | |
199 | } | |
200 | ||
201 | int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen) | |
202 | { | |
203 | unsigned char P[BLAKE2B_PARAM_SIZE]; | |
204 | int err; | |
205 | ||
206 | LTC_ARGCHK(md != NULL); | |
207 | ||
208 | if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) | |
209 | return CRYPT_INVALID_ARG; | |
210 | ||
211 | if ((key && !keylen) || (keylen && !key) || (keylen > BLAKE2B_KEYBYTES)) | |
212 | return CRYPT_INVALID_ARG; | |
213 | ||
214 | XMEMSET(P, 0, sizeof(P)); | |
215 | ||
216 | P[O_DIGEST_LENGTH] = (unsigned char)outlen; | |
217 | P[O_KEY_LENGTH] = (unsigned char)keylen; | |
218 | P[O_FANOUT] = 1; | |
219 | P[O_DEPTH] = 1; | |
220 | ||
221 | err = blake2b_init_param(md, P); | |
222 | if (err != CRYPT_OK) return err; | |
223 | ||
224 | if (key) { | |
225 | unsigned char block[BLAKE2B_BLOCKBYTES]; | |
226 | ||
227 | XMEMSET(block, 0, BLAKE2B_BLOCKBYTES); | |
228 | XMEMCPY(block, key, keylen); | |
229 | blake2b_process(md, block, BLAKE2B_BLOCKBYTES); | |
230 | ||
231 | #ifdef LTC_CLEAN_STACK | |
232 | zeromem(block, sizeof(block)); | |
233 | #endif | |
234 | } | |
235 | ||
236 | return CRYPT_OK; | |
237 | } | |
238 | ||
239 | int blake2b_160_init(hash_state *md) { return blake2b_init(md, 20, NULL, 0); } | |
240 | ||
241 | int blake2b_256_init(hash_state *md) { return blake2b_init(md, 32, NULL, 0); } | |
242 | ||
243 | int blake2b_384_init(hash_state *md) { return blake2b_init(md, 48, NULL, 0); } | |
244 | ||
245 | int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); } | |
246 | ||
247 | #define G(r, i, a, b, c, d) \ | |
248 | do { \ | |
249 | a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ | |
250 | d = ROR64(d ^ a, 32); \ | |
251 | c = c + d; \ | |
252 | b = ROR64(b ^ c, 24); \ | |
253 | a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ | |
254 | d = ROR64(d ^ a, 16); \ | |
255 | c = c + d; \ | |
256 | b = ROR64(b ^ c, 63); \ | |
257 | } while (0) | |
258 | ||
259 | #define ROUND(r) \ | |
260 | do { \ | |
261 | G(r, 0, v[0], v[4], v[8], v[12]); \ | |
262 | G(r, 1, v[1], v[5], v[9], v[13]); \ | |
263 | G(r, 2, v[2], v[6], v[10], v[14]); \ | |
264 | G(r, 3, v[3], v[7], v[11], v[15]); \ | |
265 | G(r, 4, v[0], v[5], v[10], v[15]); \ | |
266 | G(r, 5, v[1], v[6], v[11], v[12]); \ | |
267 | G(r, 6, v[2], v[7], v[8], v[13]); \ | |
268 | G(r, 7, v[3], v[4], v[9], v[14]); \ | |
269 | } while (0) | |
270 | ||
271 | #ifdef LTC_CLEAN_STACK | |
272 | static int _blake2b_compress(hash_state *md, const unsigned char *buf) | |
273 | #else | |
274 | static int blake2b_compress(hash_state *md, const unsigned char *buf) | |
275 | #endif | |
276 | { | |
277 | ulong64 m[16]; | |
278 | ulong64 v[16]; | |
279 | unsigned long i; | |
280 | ||
281 | for (i = 0; i < 16; ++i) { | |
282 | LOAD64L(m[i], buf + i * sizeof(m[i])); | |
283 | } | |
284 | ||
285 | for (i = 0; i < 8; ++i) { | |
286 | v[i] = md->blake2b.h[i]; | |
287 | } | |
288 | ||
289 | v[8] = blake2b_IV[0]; | |
290 | v[9] = blake2b_IV[1]; | |
291 | v[10] = blake2b_IV[2]; | |
292 | v[11] = blake2b_IV[3]; | |
293 | v[12] = blake2b_IV[4] ^ md->blake2b.t[0]; | |
294 | v[13] = blake2b_IV[5] ^ md->blake2b.t[1]; | |
295 | v[14] = blake2b_IV[6] ^ md->blake2b.f[0]; | |
296 | v[15] = blake2b_IV[7] ^ md->blake2b.f[1]; | |
297 | ||
298 | ROUND(0); | |
299 | ROUND(1); | |
300 | ROUND(2); | |
301 | ROUND(3); | |
302 | ROUND(4); | |
303 | ROUND(5); | |
304 | ROUND(6); | |
305 | ROUND(7); | |
306 | ROUND(8); | |
307 | ROUND(9); | |
308 | ROUND(10); | |
309 | ROUND(11); | |
310 | ||
311 | for (i = 0; i < 8; ++i) { | |
312 | md->blake2b.h[i] = md->blake2b.h[i] ^ v[i] ^ v[i + 8]; | |
313 | } | |
314 | return CRYPT_OK; | |
315 | } | |
316 | ||
317 | #undef G | |
318 | #undef ROUND | |
319 | ||
320 | #ifdef LTC_CLEAN_STACK | |
321 | static int blake2b_compress(hash_state *md, const unsigned char *buf) | |
322 | { | |
323 | int err; | |
324 | err = _blake2b_compress(md, buf); | |
325 | burn_stack(sizeof(ulong64) * 32 + sizeof(unsigned long)); | |
326 | return err; | |
327 | } | |
328 | #endif | |
329 | ||
330 | int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen) | |
331 | { | |
332 | LTC_ARGCHK(md != NULL); | |
333 | LTC_ARGCHK(in != NULL); | |
334 | ||
335 | if (md->blake2b.curlen > sizeof(md->blake2b.buf)) { | |
336 | return CRYPT_INVALID_ARG; | |
337 | } | |
338 | ||
339 | if (inlen > 0) { | |
340 | unsigned long left = md->blake2b.curlen; | |
341 | unsigned long fill = BLAKE2B_BLOCKBYTES - left; | |
342 | if (inlen > fill) { | |
343 | md->blake2b.curlen = 0; | |
344 | XMEMCPY(md->blake2b.buf + left, in, fill); /* Fill buffer */ | |
345 | blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES); | |
346 | blake2b_compress(md, md->blake2b.buf); /* Compress */ | |
347 | in += fill; | |
348 | inlen -= fill; | |
349 | while (inlen > BLAKE2B_BLOCKBYTES) { | |
350 | blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES); | |
351 | blake2b_compress(md, in); | |
352 | in += BLAKE2B_BLOCKBYTES; | |
353 | inlen -= BLAKE2B_BLOCKBYTES; | |
354 | } | |
355 | } | |
356 | XMEMCPY(md->blake2b.buf + md->blake2b.curlen, in, inlen); | |
357 | md->blake2b.curlen += inlen; | |
358 | } | |
359 | return CRYPT_OK; | |
360 | } | |
361 | ||
362 | int blake2b_done(hash_state *md, unsigned char *out) | |
363 | { | |
364 | unsigned char buffer[BLAKE2B_OUTBYTES] = { 0 }; | |
365 | unsigned long i; | |
366 | ||
367 | LTC_ARGCHK(md != NULL); | |
368 | LTC_ARGCHK(out != NULL); | |
369 | ||
370 | /* if(md->blakebs.outlen != outlen) return CRYPT_INVALID_ARG; */ | |
371 | ||
372 | if (blake2b_is_lastblock(md)) | |
373 | return CRYPT_ERROR; | |
374 | ||
375 | blake2b_increment_counter(md, md->blake2b.curlen); | |
376 | blake2b_set_lastblock(md); | |
377 | XMEMSET(md->blake2b.buf + md->blake2b.curlen, 0, BLAKE2B_BLOCKBYTES - md->blake2b.curlen); /* Padding */ | |
378 | blake2b_compress(md, md->blake2b.buf); | |
379 | ||
380 | for (i = 0; i < 8; ++i) /* Output full hash to temp buffer */ | |
381 | STORE64L(md->blake2b.h[i], buffer + i * 8); | |
382 | ||
383 | XMEMCPY(out, buffer, md->blake2b.outlen); | |
384 | zeromem(md, sizeof(hash_state)); | |
385 | #ifdef LTC_CLEAN_STACK | |
386 | zeromem(buffer, sizeof(buffer)); | |
387 | #endif | |
388 | return CRYPT_OK; | |
389 | } | |
390 | ||
391 | /** | |
392 | Self-test the hash | |
393 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
394 | */ | |
395 | int blake2b_512_test(void) | |
396 | { | |
397 | #ifndef LTC_TEST | |
398 | return CRYPT_NOP; | |
399 | #else | |
400 | static const struct { | |
401 | char *msg; | |
402 | unsigned char hash[64]; | |
403 | } tests[] = { | |
404 | { "", | |
405 | { 0x78, 0x6a, 0x02, 0xf7, 0x42, 0x01, 0x59, 0x03, | |
406 | 0xc6, 0xc6, 0xfd, 0x85, 0x25, 0x52, 0xd2, 0x72, | |
407 | 0x91, 0x2f, 0x47, 0x40, 0xe1, 0x58, 0x47, 0x61, | |
408 | 0x8a, 0x86, 0xe2, 0x17, 0xf7, 0x1f, 0x54, 0x19, | |
409 | 0xd2, 0x5e, 0x10, 0x31, 0xaf, 0xee, 0x58, 0x53, | |
410 | 0x13, 0x89, 0x64, 0x44, 0x93, 0x4e, 0xb0, 0x4b, | |
411 | 0x90, 0x3a, 0x68, 0x5b, 0x14, 0x48, 0xb7, 0x55, | |
412 | 0xd5, 0x6f, 0x70, 0x1a, 0xfe, 0x9b, 0xe2, 0xce } }, | |
413 | { "abc", | |
414 | { 0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d, | |
415 | 0x6a, 0x27, 0x97, 0xb6, 0x9f, 0x12, 0xf6, 0xe9, | |
416 | 0x4c, 0x21, 0x2f, 0x14, 0x68, 0x5a, 0xc4, 0xb7, | |
417 | 0x4b, 0x12, 0xbb, 0x6f, 0xdb, 0xff, 0xa2, 0xd1, | |
418 | 0x7d, 0x87, 0xc5, 0x39, 0x2a, 0xab, 0x79, 0x2d, | |
419 | 0xc2, 0x52, 0xd5, 0xde, 0x45, 0x33, 0xcc, 0x95, | |
420 | 0x18, 0xd3, 0x8a, 0xa8, 0xdb, 0xf1, 0x92, 0x5a, | |
421 | 0xb9, 0x23, 0x86, 0xed, 0xd4, 0x00, 0x99, 0x23 } }, | |
422 | ||
423 | { NULL, { 0 } } | |
424 | }; | |
425 | ||
426 | int i; | |
427 | unsigned char tmp[64]; | |
428 | hash_state md; | |
429 | ||
430 | for (i = 0; tests[i].msg != NULL; i++) { | |
431 | blake2b_512_init(&md); | |
432 | blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
433 | blake2b_done(&md, tmp); | |
434 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_512", i)) | |
435 | return CRYPT_FAIL_TESTVECTOR; | |
436 | } | |
437 | return CRYPT_OK; | |
438 | #endif | |
439 | } | |
440 | ||
441 | /** | |
442 | Self-test the hash | |
443 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
444 | */ | |
445 | int blake2b_384_test(void) | |
446 | { | |
447 | #ifndef LTC_TEST | |
448 | return CRYPT_NOP; | |
449 | #else | |
450 | static const struct { | |
451 | char *msg; | |
452 | unsigned char hash[48]; | |
453 | } tests[] = { | |
454 | { "", | |
455 | { 0xb3, 0x28, 0x11, 0x42, 0x33, 0x77, 0xf5, 0x2d, | |
456 | 0x78, 0x62, 0x28, 0x6e, 0xe1, 0xa7, 0x2e, 0xe5, | |
457 | 0x40, 0x52, 0x43, 0x80, 0xfd, 0xa1, 0x72, 0x4a, | |
458 | 0x6f, 0x25, 0xd7, 0x97, 0x8c, 0x6f, 0xd3, 0x24, | |
459 | 0x4a, 0x6c, 0xaf, 0x04, 0x98, 0x81, 0x26, 0x73, | |
460 | 0xc5, 0xe0, 0x5e, 0xf5, 0x83, 0x82, 0x51, 0x00 } }, | |
461 | { "abc", | |
462 | { 0x6f, 0x56, 0xa8, 0x2c, 0x8e, 0x7e, 0xf5, 0x26, | |
463 | 0xdf, 0xe1, 0x82, 0xeb, 0x52, 0x12, 0xf7, 0xdb, | |
464 | 0x9d, 0xf1, 0x31, 0x7e, 0x57, 0x81, 0x5d, 0xbd, | |
465 | 0xa4, 0x60, 0x83, 0xfc, 0x30, 0xf5, 0x4e, 0xe6, | |
466 | 0xc6, 0x6b, 0xa8, 0x3b, 0xe6, 0x4b, 0x30, 0x2d, | |
467 | 0x7c, 0xba, 0x6c, 0xe1, 0x5b, 0xb5, 0x56, 0xf4 } }, | |
468 | ||
469 | { NULL, { 0 } } | |
470 | }; | |
471 | ||
472 | int i; | |
473 | unsigned char tmp[48]; | |
474 | hash_state md; | |
475 | ||
476 | for (i = 0; tests[i].msg != NULL; i++) { | |
477 | blake2b_384_init(&md); | |
478 | blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
479 | blake2b_done(&md, tmp); | |
480 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_384", i)) | |
481 | return CRYPT_FAIL_TESTVECTOR; | |
482 | } | |
483 | return CRYPT_OK; | |
484 | #endif | |
485 | } | |
486 | ||
487 | /** | |
488 | Self-test the hash | |
489 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
490 | */ | |
491 | int blake2b_256_test(void) | |
492 | { | |
493 | #ifndef LTC_TEST | |
494 | return CRYPT_NOP; | |
495 | #else | |
496 | static const struct { | |
497 | char *msg; | |
498 | unsigned char hash[32]; | |
499 | } tests[] = { | |
500 | { "", | |
501 | { 0x0e, 0x57, 0x51, 0xc0, 0x26, 0xe5, 0x43, 0xb2, | |
502 | 0xe8, 0xab, 0x2e, 0xb0, 0x60, 0x99, 0xda, 0xa1, | |
503 | 0xd1, 0xe5, 0xdf, 0x47, 0x77, 0x8f, 0x77, 0x87, | |
504 | 0xfa, 0xab, 0x45, 0xcd, 0xf1, 0x2f, 0xe3, 0xa8 } }, | |
505 | { "abc", | |
506 | { 0xbd, 0xdd, 0x81, 0x3c, 0x63, 0x42, 0x39, 0x72, | |
507 | 0x31, 0x71, 0xef, 0x3f, 0xee, 0x98, 0x57, 0x9b, | |
508 | 0x94, 0x96, 0x4e, 0x3b, 0xb1, 0xcb, 0x3e, 0x42, | |
509 | 0x72, 0x62, 0xc8, 0xc0, 0x68, 0xd5, 0x23, 0x19 } }, | |
510 | { "12345678901234567890123456789012345678901234567890" | |
511 | "12345678901234567890123456789012345678901234567890" | |
512 | "12345678901234567890123456789012345678901234567890" | |
513 | "12345678901234567890123456789012345678901234567890" | |
514 | "12345678901234567890123456789012345678901234567890" | |
515 | "12345678901234567890123456789012345678901234567890", | |
516 | { 0x0f, 0x6e, 0x01, 0x8d, 0x38, 0xd6, 0x3f, 0x08, | |
517 | 0x4d, 0x58, 0xe3, 0x0c, 0x90, 0xfb, 0xa2, 0x41, | |
518 | 0x5f, 0xca, 0x17, 0xfa, 0x66, 0x26, 0x49, 0xf3, | |
519 | 0x8a, 0x30, 0x41, 0x7c, 0x57, 0xcd, 0xa8, 0x14 } }, | |
520 | ||
521 | { NULL, { 0 } } | |
522 | }; | |
523 | ||
524 | int i; | |
525 | unsigned char tmp[32]; | |
526 | hash_state md; | |
527 | ||
528 | for (i = 0; tests[i].msg != NULL; i++) { | |
529 | blake2b_256_init(&md); | |
530 | blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
531 | blake2b_done(&md, tmp); | |
532 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_256", i)) | |
533 | return CRYPT_FAIL_TESTVECTOR; | |
534 | } | |
535 | return CRYPT_OK; | |
536 | #endif | |
537 | } | |
538 | ||
539 | /** | |
540 | Self-test the hash | |
541 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
542 | */ | |
543 | int blake2b_160_test(void) | |
544 | { | |
545 | #ifndef LTC_TEST | |
546 | return CRYPT_NOP; | |
547 | #else | |
548 | static const struct { | |
549 | char *msg; | |
550 | unsigned char hash[20]; | |
551 | } tests[] = { | |
552 | { "", | |
553 | { 0x33, 0x45, 0x52, 0x4a, 0xbf, 0x6b, 0xbe, 0x18, | |
554 | 0x09, 0x44, 0x92, 0x24, 0xb5, 0x97, 0x2c, 0x41, | |
555 | 0x79, 0x0b, 0x6c, 0xf2 } }, | |
556 | { "abc", | |
557 | { 0x38, 0x42, 0x64, 0xf6, 0x76, 0xf3, 0x95, 0x36, | |
558 | 0x84, 0x05, 0x23, 0xf2, 0x84, 0x92, 0x1c, 0xdc, | |
559 | 0x68, 0xb6, 0x84, 0x6b } }, | |
560 | ||
561 | { NULL, { 0 } } | |
562 | }; | |
563 | ||
564 | int i; | |
565 | unsigned char tmp[20]; | |
566 | hash_state md; | |
567 | ||
568 | for (i = 0; tests[i].msg != NULL; i++) { | |
569 | blake2b_160_init(&md); | |
570 | blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
571 | blake2b_done(&md, tmp); | |
572 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_160", i)) | |
573 | return CRYPT_FAIL_TESTVECTOR; | |
574 | } | |
575 | return CRYPT_OK; | |
576 | #endif | |
577 | } | |
578 | ||
579 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | /* | |
10 | BLAKE2 reference source code package - reference C implementations | |
11 | ||
12 | Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the | |
13 | terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at | |
14 | your option. The terms of these licenses can be found at: | |
15 | ||
16 | - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 | |
17 | - OpenSSL license : https://www.openssl.org/source/license.html | |
18 | - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 | |
19 | ||
20 | More information about the BLAKE2 hash function can be found at | |
21 | https://blake2.net. | |
22 | */ | |
23 | /* see also https://www.ietf.org/rfc/rfc7693.txt */ | |
24 | ||
25 | #include "tomcrypt.h" | |
26 | ||
27 | #ifdef LTC_BLAKE2S | |
28 | ||
29 | enum blake2s_constant { | |
30 | BLAKE2S_BLOCKBYTES = 64, | |
31 | BLAKE2S_OUTBYTES = 32, | |
32 | BLAKE2S_KEYBYTES = 32, | |
33 | BLAKE2S_SALTBYTES = 8, | |
34 | BLAKE2S_PERSONALBYTES = 8, | |
35 | BLAKE2S_PARAM_SIZE = 32 | |
36 | }; | |
37 | ||
38 | /* param offsets */ | |
39 | enum { | |
40 | O_DIGEST_LENGTH = 0, | |
41 | O_KEY_LENGTH = 1, | |
42 | O_FANOUT = 2, | |
43 | O_DEPTH = 3, | |
44 | O_LEAF_LENGTH = 4, | |
45 | O_NODE_OFFSET = 8, | |
46 | O_XOF_LENGTH = 12, | |
47 | O_NODE_DEPTH = 14, | |
48 | O_INNER_LENGTH = 15, | |
49 | O_SALT = 16, | |
50 | O_PERSONAL = 24 | |
51 | }; | |
52 | ||
53 | /* | |
54 | struct blake2s_param { | |
55 | unsigned char digest_length; | |
56 | unsigned char key_length; | |
57 | unsigned char fanout; | |
58 | unsigned char depth; | |
59 | ulong32 leaf_length; | |
60 | ulong32 node_offset; | |
61 | ushort16 xof_length; | |
62 | unsigned char node_depth; | |
63 | unsigned char inner_length; | |
64 | unsigned char salt[BLAKE2S_SALTBYTES]; | |
65 | unsigned char personal[BLAKE2S_PERSONALBYTES]; | |
66 | }; | |
67 | */ | |
68 | ||
69 | const struct ltc_hash_descriptor blake2s_128_desc = | |
70 | { | |
71 | "blake2s-128", | |
72 | 21, | |
73 | 16, | |
74 | 64, | |
75 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 2, 4 }, | |
76 | 11, | |
77 | &blake2s_128_init, | |
78 | &blake2s_process, | |
79 | &blake2s_done, | |
80 | &blake2s_128_test, | |
81 | NULL | |
82 | }; | |
83 | ||
84 | const struct ltc_hash_descriptor blake2s_160_desc = | |
85 | { | |
86 | "blake2s-160", | |
87 | 22, | |
88 | 20, | |
89 | 64, | |
90 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 2, 5 }, | |
91 | 11, | |
92 | &blake2s_160_init, | |
93 | &blake2s_process, | |
94 | &blake2s_done, | |
95 | &blake2s_160_test, | |
96 | NULL | |
97 | }; | |
98 | ||
99 | const struct ltc_hash_descriptor blake2s_224_desc = | |
100 | { | |
101 | "blake2s-224", | |
102 | 23, | |
103 | 28, | |
104 | 64, | |
105 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 2, 7 }, | |
106 | 11, | |
107 | &blake2s_224_init, | |
108 | &blake2s_process, | |
109 | &blake2s_done, | |
110 | &blake2s_224_test, | |
111 | NULL | |
112 | }; | |
113 | ||
114 | const struct ltc_hash_descriptor blake2s_256_desc = | |
115 | { | |
116 | "blake2s-256", | |
117 | 24, | |
118 | 32, | |
119 | 64, | |
120 | { 1, 3, 6, 1, 4, 1, 1722, 12, 2, 2, 8 }, | |
121 | 11, | |
122 | &blake2s_256_init, | |
123 | &blake2s_process, | |
124 | &blake2s_done, | |
125 | &blake2s_256_test, | |
126 | NULL | |
127 | }; | |
128 | ||
129 | static const ulong32 blake2s_IV[8] = { | |
130 | 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, | |
131 | 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL | |
132 | }; | |
133 | ||
134 | static const unsigned char blake2s_sigma[10][16] = { | |
135 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, | |
136 | { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, | |
137 | { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, | |
138 | { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, | |
139 | { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, | |
140 | { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, | |
141 | { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, | |
142 | { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, | |
143 | { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, | |
144 | { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, | |
145 | }; | |
146 | ||
147 | static void blake2s_set_lastnode(hash_state *md) { md->blake2s.f[1] = 0xffffffffUL; } | |
148 | ||
149 | /* Some helper functions, not necessarily useful */ | |
150 | static int blake2s_is_lastblock(const hash_state *md) { return md->blake2s.f[0] != 0; } | |
151 | ||
152 | static void blake2s_set_lastblock(hash_state *md) | |
153 | { | |
154 | if (md->blake2s.last_node) | |
155 | blake2s_set_lastnode(md); | |
156 | ||
157 | md->blake2s.f[0] = 0xffffffffUL; | |
158 | } | |
159 | ||
160 | static void blake2s_increment_counter(hash_state *md, const ulong32 inc) | |
161 | { | |
162 | md->blake2s.t[0] += inc; | |
163 | md->blake2s.t[1] += (md->blake2s.t[0] < inc); | |
164 | } | |
165 | ||
166 | static int blake2s_init0(hash_state *md) | |
167 | { | |
168 | int i; | |
169 | XMEMSET(&md->blake2s, 0, sizeof(struct blake2s_state)); | |
170 | ||
171 | for (i = 0; i < 8; ++i) | |
172 | md->blake2s.h[i] = blake2s_IV[i]; | |
173 | ||
174 | return CRYPT_OK; | |
175 | } | |
176 | ||
177 | /* init2 xors IV with input parameter block */ | |
178 | static int blake2s_init_param(hash_state *md, const unsigned char *P) | |
179 | { | |
180 | unsigned long i; | |
181 | ||
182 | blake2s_init0(md); | |
183 | ||
184 | /* IV XOR ParamBlock */ | |
185 | for (i = 0; i < 8; ++i) { | |
186 | ulong32 tmp; | |
187 | LOAD32L(tmp, P + i * 4); | |
188 | md->blake2s.h[i] ^= tmp; | |
189 | } | |
190 | ||
191 | md->blake2s.outlen = P[O_DIGEST_LENGTH]; | |
192 | return CRYPT_OK; | |
193 | } | |
194 | ||
195 | int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen) | |
196 | { | |
197 | unsigned char P[BLAKE2S_PARAM_SIZE]; | |
198 | int err; | |
199 | ||
200 | LTC_ARGCHK(md != NULL); | |
201 | ||
202 | if ((!outlen) || (outlen > BLAKE2S_OUTBYTES)) | |
203 | return CRYPT_INVALID_ARG; | |
204 | ||
205 | if ((key && !keylen) || (keylen && !key) || (keylen > BLAKE2S_KEYBYTES)) | |
206 | return CRYPT_INVALID_ARG; | |
207 | ||
208 | XMEMSET(P, 0, sizeof(P)); | |
209 | ||
210 | P[O_DIGEST_LENGTH] = (unsigned char)outlen; | |
211 | P[O_KEY_LENGTH] = (unsigned char)keylen; | |
212 | P[O_FANOUT] = 1; | |
213 | P[O_DEPTH] = 1; | |
214 | ||
215 | err = blake2s_init_param(md, P); | |
216 | if (err != CRYPT_OK) return err; | |
217 | ||
218 | if (key) { | |
219 | unsigned char block[BLAKE2S_BLOCKBYTES]; | |
220 | ||
221 | XMEMSET(block, 0, BLAKE2S_BLOCKBYTES); | |
222 | XMEMCPY(block, key, keylen); | |
223 | blake2s_process(md, block, BLAKE2S_BLOCKBYTES); | |
224 | ||
225 | #ifdef LTC_CLEAN_STACK | |
226 | zeromem(block, sizeof(block)); | |
227 | #endif | |
228 | } | |
229 | return CRYPT_OK; | |
230 | } | |
231 | ||
232 | int blake2s_128_init(hash_state *md) { return blake2s_init(md, 16, NULL, 0); } | |
233 | ||
234 | int blake2s_160_init(hash_state *md) { return blake2s_init(md, 20, NULL, 0); } | |
235 | ||
236 | int blake2s_224_init(hash_state *md) { return blake2s_init(md, 28, NULL, 0); } | |
237 | ||
238 | int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); } | |
239 | ||
240 | #define G(r, i, a, b, c, d) \ | |
241 | do { \ | |
242 | a = a + b + m[blake2s_sigma[r][2 * i + 0]]; \ | |
243 | d = ROR(d ^ a, 16); \ | |
244 | c = c + d; \ | |
245 | b = ROR(b ^ c, 12); \ | |
246 | a = a + b + m[blake2s_sigma[r][2 * i + 1]]; \ | |
247 | d = ROR(d ^ a, 8); \ | |
248 | c = c + d; \ | |
249 | b = ROR(b ^ c, 7); \ | |
250 | } while (0) | |
251 | #define ROUND(r) \ | |
252 | do { \ | |
253 | G(r, 0, v[0], v[4], v[8], v[12]); \ | |
254 | G(r, 1, v[1], v[5], v[9], v[13]); \ | |
255 | G(r, 2, v[2], v[6], v[10], v[14]); \ | |
256 | G(r, 3, v[3], v[7], v[11], v[15]); \ | |
257 | G(r, 4, v[0], v[5], v[10], v[15]); \ | |
258 | G(r, 5, v[1], v[6], v[11], v[12]); \ | |
259 | G(r, 6, v[2], v[7], v[8], v[13]); \ | |
260 | G(r, 7, v[3], v[4], v[9], v[14]); \ | |
261 | } while (0) | |
262 | ||
263 | #ifdef LTC_CLEAN_STACK | |
264 | static int _blake2s_compress(hash_state *md, const unsigned char *buf) | |
265 | #else | |
266 | static int blake2s_compress(hash_state *md, const unsigned char *buf) | |
267 | #endif | |
268 | { | |
269 | unsigned long i; | |
270 | ulong32 m[16]; | |
271 | ulong32 v[16]; | |
272 | ||
273 | for (i = 0; i < 16; ++i) { | |
274 | LOAD32L(m[i], buf + i * sizeof(m[i])); | |
275 | } | |
276 | ||
277 | for (i = 0; i < 8; ++i) | |
278 | v[i] = md->blake2s.h[i]; | |
279 | ||
280 | v[8] = blake2s_IV[0]; | |
281 | v[9] = blake2s_IV[1]; | |
282 | v[10] = blake2s_IV[2]; | |
283 | v[11] = blake2s_IV[3]; | |
284 | v[12] = md->blake2s.t[0] ^ blake2s_IV[4]; | |
285 | v[13] = md->blake2s.t[1] ^ blake2s_IV[5]; | |
286 | v[14] = md->blake2s.f[0] ^ blake2s_IV[6]; | |
287 | v[15] = md->blake2s.f[1] ^ blake2s_IV[7]; | |
288 | ||
289 | ROUND(0); | |
290 | ROUND(1); | |
291 | ROUND(2); | |
292 | ROUND(3); | |
293 | ROUND(4); | |
294 | ROUND(5); | |
295 | ROUND(6); | |
296 | ROUND(7); | |
297 | ROUND(8); | |
298 | ROUND(9); | |
299 | ||
300 | for (i = 0; i < 8; ++i) | |
301 | md->blake2s.h[i] = md->blake2s.h[i] ^ v[i] ^ v[i + 8]; | |
302 | ||
303 | return CRYPT_OK; | |
304 | } | |
305 | #undef G | |
306 | #undef ROUND | |
307 | ||
308 | #ifdef LTC_CLEAN_STACK | |
309 | static int blake2s_compress(hash_state *md, const unsigned char *buf) | |
310 | { | |
311 | int err; | |
312 | err = _blake2s_compress(md, buf); | |
313 | burn_stack(sizeof(ulong32) * (32) + sizeof(unsigned long)); | |
314 | return err; | |
315 | } | |
316 | #endif | |
317 | ||
318 | int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen) | |
319 | { | |
320 | LTC_ARGCHK(md != NULL); | |
321 | LTC_ARGCHK(in != NULL); | |
322 | ||
323 | if (md->blake2s.curlen > sizeof(md->blake2s.buf)) { | |
324 | return CRYPT_INVALID_ARG; | |
325 | } | |
326 | ||
327 | if (inlen > 0) { | |
328 | unsigned long left = md->blake2s.curlen; | |
329 | unsigned long fill = BLAKE2S_BLOCKBYTES - left; | |
330 | if (inlen > fill) { | |
331 | md->blake2s.curlen = 0; | |
332 | XMEMCPY(md->blake2s.buf + left, in, fill); /* Fill buffer */ | |
333 | blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES); | |
334 | blake2s_compress(md, md->blake2s.buf); /* Compress */ | |
335 | in += fill; | |
336 | inlen -= fill; | |
337 | while (inlen > BLAKE2S_BLOCKBYTES) { | |
338 | blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES); | |
339 | blake2s_compress(md, in); | |
340 | in += BLAKE2S_BLOCKBYTES; | |
341 | inlen -= BLAKE2S_BLOCKBYTES; | |
342 | } | |
343 | } | |
344 | XMEMCPY(md->blake2s.buf + md->blake2s.curlen, in, inlen); | |
345 | md->blake2s.curlen += inlen; | |
346 | } | |
347 | return CRYPT_OK; | |
348 | } | |
349 | ||
350 | int blake2s_done(hash_state *md, unsigned char *out) | |
351 | { | |
352 | unsigned char buffer[BLAKE2S_OUTBYTES] = { 0 }; | |
353 | unsigned long i; | |
354 | ||
355 | LTC_ARGCHK(md != NULL); | |
356 | LTC_ARGCHK(out != NULL); | |
357 | ||
358 | /* if(md->blake2s.outlen != outlen) return CRYPT_INVALID_ARG; */ | |
359 | ||
360 | if (blake2s_is_lastblock(md)) | |
361 | return CRYPT_ERROR; | |
362 | ||
363 | blake2s_increment_counter(md, md->blake2s.curlen); | |
364 | blake2s_set_lastblock(md); | |
365 | XMEMSET(md->blake2s.buf + md->blake2s.curlen, 0, BLAKE2S_BLOCKBYTES - md->blake2s.curlen); /* Padding */ | |
366 | blake2s_compress(md, md->blake2s.buf); | |
367 | ||
368 | for (i = 0; i < 8; ++i) /* Output full hash to temp buffer */ | |
369 | STORE32L(md->blake2s.h[i], buffer + i * 4); | |
370 | ||
371 | XMEMCPY(out, buffer, md->blake2s.outlen); | |
372 | zeromem(md, sizeof(hash_state)); | |
373 | #ifdef LTC_CLEAN_STACK | |
374 | zeromem(buffer, sizeof(buffer)); | |
375 | #endif | |
376 | return CRYPT_OK; | |
377 | } | |
378 | ||
379 | /** | |
380 | Self-test the hash | |
381 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
382 | */ | |
383 | int blake2s_256_test(void) | |
384 | { | |
385 | #ifndef LTC_TEST | |
386 | return CRYPT_NOP; | |
387 | #else | |
388 | static const struct { | |
389 | char *msg; | |
390 | unsigned char hash[32]; | |
391 | } tests[] = { | |
392 | { "", | |
393 | { 0x69, 0x21, 0x7a, 0x30, 0x79, 0x90, 0x80, 0x94, | |
394 | 0xe1, 0x11, 0x21, 0xd0, 0x42, 0x35, 0x4a, 0x7c, | |
395 | 0x1f, 0x55, 0xb6, 0x48, 0x2c, 0xa1, 0xa5, 0x1e, | |
396 | 0x1b, 0x25, 0x0d, 0xfd, 0x1e, 0xd0, 0xee, 0xf9 } }, | |
397 | { "abc", | |
398 | { 0x50, 0x8c, 0x5e, 0x8c, 0x32, 0x7c, 0x14, 0xe2, | |
399 | 0xe1, 0xa7, 0x2b, 0xa3, 0x4e, 0xeb, 0x45, 0x2f, | |
400 | 0x37, 0x45, 0x8b, 0x20, 0x9e, 0xd6, 0x3a, 0x29, | |
401 | 0x4d, 0x99, 0x9b, 0x4c, 0x86, 0x67, 0x59, 0x82 } }, | |
402 | { "12345678901234567890123456789012345678901234567890" | |
403 | "12345678901234567890123456789012345678901234567890" | |
404 | "12345678901234567890123456789012345678901234567890" | |
405 | "12345678901234567890123456789012345678901234567890" | |
406 | "12345678901234567890123456789012345678901234567890" | |
407 | "12345678901234567890123456789012345678901234567890", | |
408 | { 0xa3, 0x78, 0x8b, 0x5b, 0x59, 0xee, 0xe4, 0x41, | |
409 | 0x95, 0x23, 0x58, 0x00, 0xa4, 0xf9, 0xfa, 0x41, | |
410 | 0x86, 0x0c, 0x7b, 0x1c, 0x35, 0xa2, 0x42, 0x70, | |
411 | 0x50, 0x80, 0x79, 0x56, 0xe3, 0xbe, 0x31, 0x74 } }, | |
412 | ||
413 | { NULL, { 0 } } | |
414 | }; | |
415 | ||
416 | int i; | |
417 | unsigned char tmp[32]; | |
418 | hash_state md; | |
419 | ||
420 | for (i = 0; tests[i].msg != NULL; i++) { | |
421 | blake2s_256_init(&md); | |
422 | blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
423 | blake2s_done(&md, tmp); | |
424 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_256", i)) | |
425 | return CRYPT_FAIL_TESTVECTOR; | |
426 | ||
427 | } | |
428 | return CRYPT_OK; | |
429 | #endif | |
430 | } | |
431 | ||
432 | /** | |
433 | Self-test the hash | |
434 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
435 | */ | |
436 | int blake2s_224_test(void) | |
437 | { | |
438 | #ifndef LTC_TEST | |
439 | return CRYPT_NOP; | |
440 | #else | |
441 | static const struct { | |
442 | char *msg; | |
443 | unsigned char hash[28]; | |
444 | } tests[] = { | |
445 | { "", | |
446 | { 0x1f, 0xa1, 0x29, 0x1e, 0x65, 0x24, 0x8b, 0x37, | |
447 | 0xb3, 0x43, 0x34, 0x75, 0xb2, 0xa0, 0xdd, 0x63, | |
448 | 0xd5, 0x4a, 0x11, 0xec, 0xc4, 0xe3, 0xe0, 0x34, | |
449 | 0xe7, 0xbc, 0x1e, 0xf4 } }, | |
450 | { "abc", | |
451 | { 0x0b, 0x03, 0x3f, 0xc2, 0x26, 0xdf, 0x7a, 0xbd, | |
452 | 0xe2, 0x9f, 0x67, 0xa0, 0x5d, 0x3d, 0xc6, 0x2c, | |
453 | 0xf2, 0x71, 0xef, 0x3d, 0xfe, 0xa4, 0xd3, 0x87, | |
454 | 0x40, 0x7f, 0xbd, 0x55 } }, | |
455 | ||
456 | { NULL, { 0 } } | |
457 | }; | |
458 | ||
459 | int i; | |
460 | unsigned char tmp[28]; | |
461 | hash_state md; | |
462 | ||
463 | for (i = 0; tests[i].msg != NULL; i++) { | |
464 | blake2s_224_init(&md); | |
465 | blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
466 | blake2s_done(&md, tmp); | |
467 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_224", i)) | |
468 | return CRYPT_FAIL_TESTVECTOR; | |
469 | ||
470 | } | |
471 | return CRYPT_OK; | |
472 | #endif | |
473 | } | |
474 | ||
475 | /** | |
476 | Self-test the hash | |
477 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
478 | */ | |
479 | int blake2s_160_test(void) | |
480 | { | |
481 | #ifndef LTC_TEST | |
482 | return CRYPT_NOP; | |
483 | #else | |
484 | static const struct { | |
485 | char *msg; | |
486 | unsigned char hash[20]; | |
487 | } tests[] = { | |
488 | { "", | |
489 | { 0x35, 0x4c, 0x9c, 0x33, 0xf7, 0x35, 0x96, 0x24, | |
490 | 0x18, 0xbd, 0xac, 0xb9, 0x47, 0x98, 0x73, 0x42, | |
491 | 0x9c, 0x34, 0x91, 0x6f} }, | |
492 | { "abc", | |
493 | { 0x5a, 0xe3, 0xb9, 0x9b, 0xe2, 0x9b, 0x01, 0x83, | |
494 | 0x4c, 0x3b, 0x50, 0x85, 0x21, 0xed, 0xe6, 0x04, | |
495 | 0x38, 0xf8, 0xde, 0x17 } }, | |
496 | ||
497 | { NULL, { 0 } } | |
498 | }; | |
499 | ||
500 | int i; | |
501 | unsigned char tmp[20]; | |
502 | hash_state md; | |
503 | ||
504 | for (i = 0; tests[i].msg != NULL; i++) { | |
505 | blake2s_160_init(&md); | |
506 | blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
507 | blake2s_done(&md, tmp); | |
508 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_160", i)) | |
509 | return CRYPT_FAIL_TESTVECTOR; | |
510 | ||
511 | } | |
512 | return CRYPT_OK; | |
513 | #endif | |
514 | } | |
515 | ||
516 | /** | |
517 | Self-test the hash | |
518 | @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled | |
519 | */ | |
520 | int blake2s_128_test(void) | |
521 | { | |
522 | #ifndef LTC_TEST | |
523 | return CRYPT_NOP; | |
524 | #else | |
525 | static const struct { | |
526 | char *msg; | |
527 | unsigned char hash[16]; | |
528 | } tests[] = { | |
529 | { "", | |
530 | { 0x64, 0x55, 0x0d, 0x6f, 0xfe, 0x2c, 0x0a, 0x01, | |
531 | 0xa1, 0x4a, 0xba, 0x1e, 0xad, 0xe0, 0x20, 0x0c } }, | |
532 | { "abc", | |
533 | { 0xaa, 0x49, 0x38, 0x11, 0x9b, 0x1d, 0xc7, 0xb8, | |
534 | 0x7c, 0xba, 0xd0, 0xff, 0xd2, 0x00, 0xd0, 0xae } }, | |
535 | ||
536 | { NULL, { 0 } } | |
537 | }; | |
538 | ||
539 | int i; | |
540 | unsigned char tmp[16]; | |
541 | hash_state md; | |
542 | ||
543 | for (i = 0; tests[i].msg != NULL; i++) { | |
544 | blake2s_128_init(&md); | |
545 | blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | |
546 | blake2s_done(&md, tmp); | |
547 | if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_128", i)) | |
548 | return CRYPT_FAIL_TESTVECTOR; | |
549 | } | |
550 | return CRYPT_OK; | |
551 | #endif | |
552 | } | |
553 | ||
554 | #endif |
14 | 14 | |
15 | 15 | const struct ltc_hash_descriptor sha3_224_desc = |
16 | 16 | { |
17 | "sha3_224", /* name of hash */ | |
17 | "sha3-224", /* name of hash */ | |
18 | 18 | 17, /* internal ID */ |
19 | 19 | 28, /* Size of digest in octets */ |
20 | 20 | 128, /* Input block size in octets */ |
29 | 29 | |
30 | 30 | const struct ltc_hash_descriptor sha3_256_desc = |
31 | 31 | { |
32 | "sha3_256", /* name of hash */ | |
32 | "sha3-256", /* name of hash */ | |
33 | 33 | 18, /* internal ID */ |
34 | 34 | 32, /* Size of digest in octets */ |
35 | 35 | 128, /* Input block size in octets */ |
44 | 44 | |
45 | 45 | const struct ltc_hash_descriptor sha3_384_desc = |
46 | 46 | { |
47 | "sha3_384", /* name of hash */ | |
47 | "sha3-384", /* name of hash */ | |
48 | 48 | 19, /* internal ID */ |
49 | 49 | 48, /* Size of digest in octets */ |
50 | 50 | 128, /* Input block size in octets */ |
59 | 59 | |
60 | 60 | const struct ltc_hash_descriptor sha3_512_desc = |
61 | 61 | { |
62 | "sha3_512", /* name of hash */ | |
62 | "sha3-512", /* name of hash */ | |
63 | 63 | 20, /* internal ID */ |
64 | 64 | 64, /* Size of digest in octets */ |
65 | 65 | 128, /* Input block size in octets */ |
247 | 247 | #define LTC_RIPEMD160 |
248 | 248 | #define LTC_RIPEMD256 |
249 | 249 | #define LTC_RIPEMD320 |
250 | #define LTC_BLAKE2S | |
251 | #define LTC_BLAKE2B | |
250 | 252 | |
251 | 253 | #define LTC_HASH_HELPERS |
252 | 254 | |
263 | 265 | #define LTC_F9_MODE |
264 | 266 | #define LTC_PELICAN |
265 | 267 | #define LTC_POLY1305 |
268 | #define LTC_BLAKE2SMAC | |
269 | #define LTC_BLAKE2BMAC | |
266 | 270 | |
267 | 271 | /* ---> Encrypt + Authenticate Modes <--- */ |
268 | 272 | |
296 | 300 | /* a PRNG that simply reads from an available system source */ |
297 | 301 | #define LTC_SPRNG |
298 | 302 | |
299 | /* The LTC_RC4 stream cipher based PRNG */ | |
303 | /* The RC4 stream cipher based PRNG */ | |
300 | 304 | #define LTC_RC4_PRNG |
301 | 305 | |
302 | 306 | /* The ChaCha20 stream cipher based PRNG */ |
560 | 564 | #error LTC_SOBER128_PRNG requires LTC_SOBER128 |
561 | 565 | #endif |
562 | 566 | |
567 | #if defined(LTC_BLAKE2SMAC) && !defined(LTC_BLAKE2S) | |
568 | #error LTC_BLAKE2SMAC requires LTC_BLAKE2S | |
569 | #endif | |
570 | ||
571 | #if defined(LTC_BLAKE2BMAC) && !defined(LTC_BLAKE2B) | |
572 | #error LTC_BLAKE2BMAC requires LTC_BLAKE2B | |
573 | #endif | |
574 | ||
563 | 575 | /* THREAD management */ |
564 | 576 | #ifdef LTC_PTHREAD |
565 | 577 | |
586 | 598 | |
587 | 599 | /* Debuggers */ |
588 | 600 | |
589 | /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */ | |
601 | /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */ | |
590 | 602 | /* #define LTC_VALGRIND */ |
591 | 603 | |
592 | 604 | #endif |
112 | 112 | }; |
113 | 113 | #endif |
114 | 114 | |
115 | #ifdef LTC_BLAKE2S | |
116 | struct blake2s_state { | |
117 | ulong32 h[8]; | |
118 | ulong32 t[2]; | |
119 | ulong32 f[2]; | |
120 | unsigned char buf[64]; | |
121 | unsigned long curlen; | |
122 | unsigned long outlen; | |
123 | unsigned char last_node; | |
124 | }; | |
125 | #endif | |
126 | ||
127 | #ifdef LTC_BLAKE2B | |
128 | struct blake2b_state { | |
129 | ulong64 h[8]; | |
130 | ulong64 t[2]; | |
131 | ulong64 f[2]; | |
132 | unsigned char buf[128]; | |
133 | unsigned long curlen; | |
134 | unsigned long outlen; | |
135 | unsigned char last_node; | |
136 | }; | |
137 | #endif | |
138 | ||
115 | 139 | typedef union Hash_state { |
116 | 140 | char dummy[1]; |
117 | 141 | #ifdef LTC_CHC_HASH |
156 | 180 | #ifdef LTC_RIPEMD320 |
157 | 181 | struct rmd320_state rmd320; |
158 | 182 | #endif |
183 | #ifdef LTC_BLAKE2S | |
184 | struct blake2s_state blake2s; | |
185 | #endif | |
186 | #ifdef LTC_BLAKE2B | |
187 | struct blake2b_state blake2b; | |
188 | #endif | |
189 | ||
159 | 190 | void *data; |
160 | 191 | } hash_state; |
161 | 192 | |
311 | 342 | int sha1_done(hash_state * md, unsigned char *hash); |
312 | 343 | int sha1_test(void); |
313 | 344 | extern const struct ltc_hash_descriptor sha1_desc; |
345 | #endif | |
346 | ||
347 | #ifdef LTC_BLAKE2S | |
348 | extern const struct ltc_hash_descriptor blake2s_256_desc; | |
349 | int blake2s_256_init(hash_state * md); | |
350 | int blake2s_256_test(void); | |
351 | ||
352 | extern const struct ltc_hash_descriptor blake2s_224_desc; | |
353 | int blake2s_224_init(hash_state * md); | |
354 | int blake2s_224_test(void); | |
355 | ||
356 | extern const struct ltc_hash_descriptor blake2s_160_desc; | |
357 | int blake2s_160_init(hash_state * md); | |
358 | int blake2s_160_test(void); | |
359 | ||
360 | extern const struct ltc_hash_descriptor blake2s_128_desc; | |
361 | int blake2s_128_init(hash_state * md); | |
362 | int blake2s_128_test(void); | |
363 | ||
364 | int blake2s_init(hash_state * md, unsigned long outlen, const unsigned char *key, unsigned long keylen); | |
365 | int blake2s_process(hash_state * md, const unsigned char *in, unsigned long inlen); | |
366 | int blake2s_done(hash_state * md, unsigned char *hash); | |
367 | #endif | |
368 | ||
369 | #ifdef LTC_BLAKE2B | |
370 | extern const struct ltc_hash_descriptor blake2b_512_desc; | |
371 | int blake2b_512_init(hash_state * md); | |
372 | int blake2b_512_test(void); | |
373 | ||
374 | extern const struct ltc_hash_descriptor blake2b_384_desc; | |
375 | int blake2b_384_init(hash_state * md); | |
376 | int blake2b_384_test(void); | |
377 | ||
378 | extern const struct ltc_hash_descriptor blake2b_256_desc; | |
379 | int blake2b_256_init(hash_state * md); | |
380 | int blake2b_256_test(void); | |
381 | ||
382 | extern const struct ltc_hash_descriptor blake2b_160_desc; | |
383 | int blake2b_160_init(hash_state * md); | |
384 | int blake2b_160_test(void); | |
385 | ||
386 | int blake2b_init(hash_state * md, unsigned long outlen, const unsigned char *key, unsigned long keylen); | |
387 | int blake2b_process(hash_state * md, const unsigned char *in, unsigned long inlen); | |
388 | int blake2b_done(hash_state * md, unsigned char *hash); | |
314 | 389 | #endif |
315 | 390 | |
316 | 391 | #ifdef LTC_MD5 |
115 | 115 | int poly1305_test(void); |
116 | 116 | #endif /* LTC_POLY1305 */ |
117 | 117 | |
118 | #ifdef LTC_BLAKE2SMAC | |
119 | typedef hash_state blake2smac_state; | |
120 | int blake2smac_init(blake2smac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen); | |
121 | int blake2smac_process(blake2smac_state *st, const unsigned char *in, unsigned long inlen); | |
122 | int blake2smac_done(blake2smac_state *st, unsigned char *mac, unsigned long *maclen); | |
123 | int blake2smac_test(void); | |
124 | int blake2smac_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen); | |
125 | int blake2smac_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...); | |
126 | int blake2smac_file(const char *fname, const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen); | |
127 | int blake2smac_test(void); | |
128 | #endif /* LTC_BLAKE2SMAC */ | |
129 | ||
130 | #ifdef LTC_BLAKE2BMAC | |
131 | typedef hash_state blake2bmac_state; | |
132 | int blake2bmac_init(blake2bmac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen); | |
133 | int blake2bmac_process(blake2bmac_state *st, const unsigned char *in, unsigned long inlen); | |
134 | int blake2bmac_done(blake2bmac_state *st, unsigned char *mac, unsigned long *maclen); | |
135 | int blake2bmac_test(void); | |
136 | int blake2bmac_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen); | |
137 | int blake2bmac_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...); | |
138 | int blake2bmac_file(const char *fname, const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen); | |
139 | int blake2bmac_test(void); | |
140 | #endif /* LTC_BLAKE2BMAC */ | |
141 | ||
118 | 142 | #ifdef LTC_EAX_MODE |
119 | 143 | |
120 | 144 | #if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE)) |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2BMAC | |
12 | ||
13 | /** | |
14 | Initialize an BLAKE2B MAC context. | |
15 | @param st The BLAKE2B MAC state | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key (octets) | |
18 | @return CRYPT_OK if successful | |
19 | */ | |
20 | int blake2bmac_init(blake2bmac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen) | |
21 | { | |
22 | LTC_ARGCHK(st != NULL); | |
23 | LTC_ARGCHK(key != NULL); | |
24 | return blake2b_init(st, outlen, key, keylen); | |
25 | } | |
26 | ||
27 | /** | |
28 | Process data through BLAKE2B MAC | |
29 | @param st The BLAKE2B MAC state | |
30 | @param in The data to send through HMAC | |
31 | @param inlen The length of the data to HMAC (octets) | |
32 | @return CRYPT_OK if successful | |
33 | */ | |
34 | int blake2bmac_process(blake2bmac_state *st, const unsigned char *in, unsigned long inlen) | |
35 | { | |
36 | if (inlen == 0) return CRYPT_OK; /* nothing to do */ | |
37 | LTC_ARGCHK(st != NULL); | |
38 | LTC_ARGCHK(in != NULL); | |
39 | return blake2b_process(st, in, inlen); | |
40 | } | |
41 | ||
42 | /** | |
43 | Terminate a BLAKE2B MAC session | |
44 | @param st The BLAKE2B MAC state | |
45 | @param mac [out] The destination of the BLAKE2B MAC authentication tag | |
46 | @param maclen [in/out] The max size and resulting size of the BLAKE2B MAC authentication tag | |
47 | @return CRYPT_OK if successful | |
48 | */ | |
49 | int blake2bmac_done(blake2bmac_state *st, unsigned char *mac, unsigned long *maclen) | |
50 | { | |
51 | LTC_ARGCHK(st != NULL); | |
52 | LTC_ARGCHK(mac != NULL); | |
53 | LTC_ARGCHK(maclen != NULL); | |
54 | LTC_ARGCHK(*maclen >= st->blake2b.outlen); | |
55 | ||
56 | *maclen = st->blake2b.outlen; | |
57 | return blake2b_done(st, mac); | |
58 | } | |
59 | ||
60 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2BMAC | |
12 | ||
13 | /** | |
14 | BLAKE2B MAC a file | |
15 | @param fname The name of the file you wish to BLAKE2B MAC | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key | |
18 | @param mac [out] The BLAKE2B MAC authentication tag | |
19 | @param maclen [in/out] The max size and resulting size of the authentication tag | |
20 | @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled | |
21 | */ | |
22 | int blake2bmac_file(const char *fname, const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen) | |
23 | { | |
24 | #ifdef LTC_NO_FILE | |
25 | return CRYPT_NOP; | |
26 | #else | |
27 | blake2bmac_state st; | |
28 | FILE *in; | |
29 | unsigned char *buf; | |
30 | size_t x; | |
31 | int err; | |
32 | ||
33 | LTC_ARGCHK(fname != NULL); | |
34 | LTC_ARGCHK(key != NULL); | |
35 | LTC_ARGCHK(mac != NULL); | |
36 | LTC_ARGCHK(maclen != NULL); | |
37 | ||
38 | if ((buf = XMALLOC(LTC_FILE_READ_BUFSIZE)) == NULL) { | |
39 | return CRYPT_MEM; | |
40 | } | |
41 | ||
42 | if ((err = blake2bmac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { | |
43 | goto LBL_ERR; | |
44 | } | |
45 | ||
46 | in = fopen(fname, "rb"); | |
47 | if (in == NULL) { | |
48 | err = CRYPT_FILE_NOTFOUND; | |
49 | goto LBL_ERR; | |
50 | } | |
51 | ||
52 | do { | |
53 | x = fread(buf, 1, LTC_FILE_READ_BUFSIZE, in); | |
54 | if ((err = blake2bmac_process(&st, buf, (unsigned long)x)) != CRYPT_OK) { | |
55 | fclose(in); | |
56 | goto LBL_CLEANBUF; | |
57 | } | |
58 | } while (x == LTC_FILE_READ_BUFSIZE); | |
59 | ||
60 | if (fclose(in) != 0) { | |
61 | err = CRYPT_ERROR; | |
62 | goto LBL_CLEANBUF; | |
63 | } | |
64 | ||
65 | err = blake2bmac_done(&st, mac, maclen); | |
66 | ||
67 | LBL_CLEANBUF: | |
68 | zeromem(buf, LTC_FILE_READ_BUFSIZE); | |
69 | LBL_ERR: | |
70 | #ifdef LTC_CLEAN_STACK | |
71 | zeromem(&st, sizeof(blake2bmac_state)); | |
72 | #endif | |
73 | XFREE(buf); | |
74 | return err; | |
75 | #endif | |
76 | } | |
77 | ||
78 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2BMAC | |
12 | ||
13 | /** | |
14 | BLAKE2B MAC a block of memory to produce the authentication tag | |
15 | @param key The secret key | |
16 | @param keylen The length of the secret key (octets) | |
17 | @param in The data to BLAKE2B MAC | |
18 | @param inlen The length of the data to BLAKE2B MAC (octets) | |
19 | @param mac [out] Destination of the authentication tag | |
20 | @param maclen [in/out] Max size and resulting size of authentication tag | |
21 | @return CRYPT_OK if successful | |
22 | */ | |
23 | int blake2bmac_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen) | |
24 | { | |
25 | blake2bmac_state st; | |
26 | int err; | |
27 | ||
28 | LTC_ARGCHK(key != NULL); | |
29 | LTC_ARGCHK(in != NULL); | |
30 | LTC_ARGCHK(mac != NULL); | |
31 | LTC_ARGCHK(maclen != NULL); | |
32 | ||
33 | if ((err = blake2bmac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } | |
34 | if ((err = blake2bmac_process(&st, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } | |
35 | err = blake2bmac_done(&st, mac, maclen); | |
36 | LBL_ERR: | |
37 | #ifdef LTC_CLEAN_STACK | |
38 | zeromem(&st, sizeof(blake2bmac_state)); | |
39 | #endif | |
40 | return err; | |
41 | } | |
42 | ||
43 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | #include <stdarg.h> | |
11 | ||
12 | #ifdef LTC_BLAKE2BMAC | |
13 | ||
14 | /** | |
15 | BLAKE2B MAC multiple blocks of memory to produce the authentication tag | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key (octets) | |
18 | @param out [out] Destination of the authentication tag | |
19 | @param outlen [in/out] Max size and resulting size of authentication tag | |
20 | @param in The data to BLAKE2B MAC | |
21 | @param inlen The length of the data to BLAKE2B MAC (octets) | |
22 | @param ... tuples of (data,len) pairs to BLAKE2B MAC, terminated with a (NULL,x) (x=don't care) | |
23 | @return CRYPT_OK if successful | |
24 | */ | |
25 | int blake2bmac_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...) | |
26 | { | |
27 | blake2bmac_state st; | |
28 | int err; | |
29 | va_list args; | |
30 | const unsigned char *curptr; | |
31 | unsigned long curlen; | |
32 | ||
33 | LTC_ARGCHK(key != NULL); | |
34 | LTC_ARGCHK(in != NULL); | |
35 | LTC_ARGCHK(mac != NULL); | |
36 | LTC_ARGCHK(maclen != NULL); | |
37 | ||
38 | va_start(args, inlen); | |
39 | curptr = in; | |
40 | curlen = inlen; | |
41 | if ((err = blake2bmac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } | |
42 | for (;;) { | |
43 | if ((err = blake2bmac_process(&st, curptr, curlen)) != CRYPT_OK) { goto LBL_ERR; } | |
44 | curptr = va_arg(args, const unsigned char*); | |
45 | if (curptr == NULL) break; | |
46 | curlen = va_arg(args, unsigned long); | |
47 | } | |
48 | err = blake2bmac_done(&st, mac, maclen); | |
49 | LBL_ERR: | |
50 | #ifdef LTC_CLEAN_STACK | |
51 | zeromem(&st, sizeof(blake2bmac_state)); | |
52 | #endif | |
53 | va_end(args); | |
54 | return err; | |
55 | } | |
56 | ||
57 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2SMAC | |
12 | ||
13 | /** | |
14 | Initialize an BLAKE2S MAC context. | |
15 | @param st The BLAKE2S MAC state | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key (octets) | |
18 | @return CRYPT_OK if successful | |
19 | */ | |
20 | int blake2smac_init(blake2smac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen) | |
21 | { | |
22 | LTC_ARGCHK(st != NULL); | |
23 | LTC_ARGCHK(key != NULL); | |
24 | return blake2s_init(st, outlen, key, keylen); | |
25 | } | |
26 | ||
27 | /** | |
28 | Process data through BLAKE2S MAC | |
29 | @param st The BLAKE2S MAC state | |
30 | @param in The data to send through HMAC | |
31 | @param inlen The length of the data to HMAC (octets) | |
32 | @return CRYPT_OK if successful | |
33 | */ | |
34 | int blake2smac_process(blake2smac_state *st, const unsigned char *in, unsigned long inlen) | |
35 | { | |
36 | if (inlen == 0) return CRYPT_OK; /* nothing to do */ | |
37 | LTC_ARGCHK(st != NULL); | |
38 | LTC_ARGCHK(in != NULL); | |
39 | return blake2s_process(st, in, inlen); | |
40 | } | |
41 | ||
42 | /** | |
43 | Terminate a BLAKE2S MAC session | |
44 | @param st The BLAKE2S MAC state | |
45 | @param mac [out] The destination of the BLAKE2S MAC authentication tag | |
46 | @param maclen [in/out] The max size and resulting size of the BLAKE2S MAC authentication tag | |
47 | @return CRYPT_OK if successful | |
48 | */ | |
49 | int blake2smac_done(blake2smac_state *st, unsigned char *mac, unsigned long *maclen) | |
50 | { | |
51 | LTC_ARGCHK(st != NULL); | |
52 | LTC_ARGCHK(mac != NULL); | |
53 | LTC_ARGCHK(maclen != NULL); | |
54 | LTC_ARGCHK(*maclen >= st->blake2s.outlen); | |
55 | ||
56 | *maclen = st->blake2s.outlen; | |
57 | return blake2s_done(st, mac); | |
58 | } | |
59 | ||
60 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2SMAC | |
12 | ||
13 | /** | |
14 | BLAKE2S MAC a file | |
15 | @param fname The name of the file you wish to BLAKE2S MAC | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key | |
18 | @param mac [out] The BLAKE2S MAC authentication tag | |
19 | @param maclen [in/out] The max size and resulting size of the authentication tag | |
20 | @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled | |
21 | */ | |
22 | int blake2smac_file(const char *fname, const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen) | |
23 | { | |
24 | #ifdef LTC_NO_FILE | |
25 | return CRYPT_NOP; | |
26 | #else | |
27 | blake2smac_state st; | |
28 | FILE *in; | |
29 | unsigned char *buf; | |
30 | size_t x; | |
31 | int err; | |
32 | ||
33 | LTC_ARGCHK(fname != NULL); | |
34 | LTC_ARGCHK(key != NULL); | |
35 | LTC_ARGCHK(mac != NULL); | |
36 | LTC_ARGCHK(maclen != NULL); | |
37 | ||
38 | if ((buf = XMALLOC(LTC_FILE_READ_BUFSIZE)) == NULL) { | |
39 | return CRYPT_MEM; | |
40 | } | |
41 | ||
42 | if ((err = blake2smac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { | |
43 | goto LBL_ERR; | |
44 | } | |
45 | ||
46 | in = fopen(fname, "rb"); | |
47 | if (in == NULL) { | |
48 | err = CRYPT_FILE_NOTFOUND; | |
49 | goto LBL_ERR; | |
50 | } | |
51 | ||
52 | do { | |
53 | x = fread(buf, 1, LTC_FILE_READ_BUFSIZE, in); | |
54 | if ((err = blake2smac_process(&st, buf, (unsigned long)x)) != CRYPT_OK) { | |
55 | fclose(in); | |
56 | goto LBL_CLEANBUF; | |
57 | } | |
58 | } while (x == LTC_FILE_READ_BUFSIZE); | |
59 | ||
60 | if (fclose(in) != 0) { | |
61 | err = CRYPT_ERROR; | |
62 | goto LBL_CLEANBUF; | |
63 | } | |
64 | ||
65 | err = blake2smac_done(&st, mac, maclen); | |
66 | ||
67 | LBL_CLEANBUF: | |
68 | zeromem(buf, LTC_FILE_READ_BUFSIZE); | |
69 | LBL_ERR: | |
70 | #ifdef LTC_CLEAN_STACK | |
71 | zeromem(&st, sizeof(blake2smac_state)); | |
72 | #endif | |
73 | XFREE(buf); | |
74 | return err; | |
75 | #endif | |
76 | } | |
77 | ||
78 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | ||
11 | #ifdef LTC_BLAKE2SMAC | |
12 | ||
13 | /** | |
14 | BLAKE2S MAC a block of memory to produce the authentication tag | |
15 | @param key The secret key | |
16 | @param keylen The length of the secret key (octets) | |
17 | @param in The data to BLAKE2S MAC | |
18 | @param inlen The length of the data to BLAKE2S MAC (octets) | |
19 | @param mac [out] Destination of the authentication tag | |
20 | @param maclen [in/out] Max size and resulting size of authentication tag | |
21 | @return CRYPT_OK if successful | |
22 | */ | |
23 | int blake2smac_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen) | |
24 | { | |
25 | blake2smac_state st; | |
26 | int err; | |
27 | ||
28 | LTC_ARGCHK(key != NULL); | |
29 | LTC_ARGCHK(in != NULL); | |
30 | LTC_ARGCHK(mac != NULL); | |
31 | LTC_ARGCHK(maclen != NULL); | |
32 | ||
33 | if ((err = blake2smac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } | |
34 | if ((err = blake2smac_process(&st, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } | |
35 | err = blake2smac_done(&st, mac, maclen); | |
36 | LBL_ERR: | |
37 | #ifdef LTC_CLEAN_STACK | |
38 | zeromem(&st, sizeof(blake2smac_state)); | |
39 | #endif | |
40 | return err; | |
41 | } | |
42 | ||
43 | #endif |
0 | /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
1 | * | |
2 | * LibTomCrypt is a library that provides various cryptographic | |
3 | * algorithms in a highly modular and flexible manner. | |
4 | * | |
5 | * The library is free for all purposes without any express | |
6 | * guarantee it works. | |
7 | */ | |
8 | ||
9 | #include "tomcrypt.h" | |
10 | #include <stdarg.h> | |
11 | ||
12 | #ifdef LTC_BLAKE2SMAC | |
13 | ||
14 | /** | |
15 | BLAKE2S MAC multiple blocks of memory to produce the authentication tag | |
16 | @param key The secret key | |
17 | @param keylen The length of the secret key (octets) | |
18 | @param out [out] Destination of the authentication tag | |
19 | @param outlen [in/out] Max size and resulting size of authentication tag | |
20 | @param in The data to BLAKE2S MAC | |
21 | @param inlen The length of the data to BLAKE2S MAC (octets) | |
22 | @param ... tuples of (data,len) pairs to BLAKE2S MAC, terminated with a (NULL,x) (x=don't care) | |
23 | @return CRYPT_OK if successful | |
24 | */ | |
25 | int blake2smac_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...) | |
26 | { | |
27 | blake2smac_state st; | |
28 | int err; | |
29 | va_list args; | |
30 | const unsigned char *curptr; | |
31 | unsigned long curlen; | |
32 | ||
33 | LTC_ARGCHK(key != NULL); | |
34 | LTC_ARGCHK(in != NULL); | |
35 | LTC_ARGCHK(mac != NULL); | |
36 | LTC_ARGCHK(maclen != NULL); | |
37 | ||
38 | va_start(args, inlen); | |
39 | curptr = in; | |
40 | curlen = inlen; | |
41 | if ((err = blake2smac_init(&st, *maclen, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } | |
42 | for (;;) { | |
43 | if ((err = blake2smac_process(&st, curptr, curlen)) != CRYPT_OK) { goto LBL_ERR; } | |
44 | curptr = va_arg(args, const unsigned char*); | |
45 | if (curptr == NULL) break; | |
46 | curlen = va_arg(args, unsigned long); | |
47 | } | |
48 | err = blake2smac_done(&st, mac, maclen); | |
49 | LBL_ERR: | |
50 | #ifdef LTC_CLEAN_STACK | |
51 | zeromem(&st, sizeof(blake2smac_state)); | |
52 | #endif | |
53 | va_end(args); | |
54 | return err; | |
55 | } | |
56 | ||
57 | #endif |
0 | #!/usr/bin/env perl | |
1 | ||
2 | use Modern::Perl; | |
3 | use File::Find qw(find); | |
4 | use File::Slurper qw(read_text write_text); | |
5 | use FindBin; | |
6 | ||
7 | my @objs = (); | |
8 | find({ wanted=>sub { push @objs, $_ if $_ =~ /\.c$/ && $_ !~ /tab\.c$/}, no_chdir=>1 }, "$FindBin::Bin/ltc"); | |
9 | find({ wanted=>sub { push @objs, $_ if $_ =~ /\.c$/ }, no_chdir=>1 }, "$FindBin::Bin/ltm"); | |
10 | ||
11 | my $o = "OBJS=" . (join " ", map { s/\.c$/.o/r } map { s!^.*/(ltm|ltc)/!$1/!r } @objs) =~ s/(.{80}) /$1 \\\n/gr; | |
12 | my $obj = "OBJS=" . (join " ", map { s/\.c$/.obj/r } map { s!^.*/(ltm|ltc)/!$1/!r } @objs) =~ s/(.{80}) /$1 \\\n/gr; | |
13 | ||
14 | write_text("$FindBin::Bin/Makefile", read_text("$FindBin::Bin/Makefile") =~ s/OBJS=.+?\.o\n/$o\n/sr); | |
15 | write_text("$FindBin::Bin/Makefile.nmake", read_text("$FindBin::Bin/Makefile.nmake") =~ s/OBJS=.+?\.obj\n/$obj\n/sr); |
4 | 4 | |
5 | 5 | plan skip_all => "File::Find not installed" unless eval { require File::Find }; |
6 | 6 | plan skip_all => "Test::Pod not installed" unless eval { require Test::Pod }; |
7 | plan tests => 88; | |
7 | plan tests => 98; | |
8 | 8 | |
9 | 9 | my @files; |
10 | 10 | 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 + 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::BLAKE2b_160 qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2b_160'), 20, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2b_160'), 20, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2b_160::hashsize, 20, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2b_160->hashsize, 20, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2b_160')->hashsize, 20, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2b_160->new->hashsize, 20, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2b_160(""), pack("H*","3345524abf6bbe1809449224b5972c41790b6cf2"), 'blake2b_160 (raw/1)'); | |
19 | is( blake2b_160_hex(""), "3345524abf6bbe1809449224b5972c41790b6cf2", 'blake2b_160 (hex/1)'); | |
20 | is( blake2b_160_b64(""), "M0VSSr9rvhgJRJIktZcsQXkLbPI=", 'blake2b_160 (base64/1)'); | |
21 | is( digest_data('BLAKE2b_160', ""), pack("H*","3345524abf6bbe1809449224b5972c41790b6cf2"), 'blake2b_160 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2b_160', ""), "3345524abf6bbe1809449224b5972c41790b6cf2", 'blake2b_160 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2b_160', ""), "M0VSSr9rvhgJRJIktZcsQXkLbPI=", 'blake2b_160 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2b_160', ""), "M0VSSr9rvhgJRJIktZcsQXkLbPI", 'blake2b_160 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2b_160->new->add("")->hexdigest, "3345524abf6bbe1809449224b5972c41790b6cf2", 'blake2b_160 (OO/1)'); | |
26 | ||
27 | is( blake2b_160("123"), pack("H*","c018e33a9cf2fea6a3bb41c4c079ea4fbc901d28"), 'blake2b_160 (raw/2)'); | |
28 | is( blake2b_160_hex("123"), "c018e33a9cf2fea6a3bb41c4c079ea4fbc901d28", 'blake2b_160 (hex/2)'); | |
29 | is( blake2b_160_b64("123"), "wBjjOpzy/qaju0HEwHnqT7yQHSg=", 'blake2b_160 (base64/2)'); | |
30 | is( digest_data('BLAKE2b_160', "123"), pack("H*","c018e33a9cf2fea6a3bb41c4c079ea4fbc901d28"), 'blake2b_160 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2b_160', "123"), "c018e33a9cf2fea6a3bb41c4c079ea4fbc901d28", 'blake2b_160 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2b_160', "123"), "wBjjOpzy/qaju0HEwHnqT7yQHSg=", 'blake2b_160 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2b_160', "123"), "wBjjOpzy_qaju0HEwHnqT7yQHSg", 'blake2b_160 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2b_160->new->add("123")->hexdigest, "c018e33a9cf2fea6a3bb41c4c079ea4fbc901d28", 'blake2b_160 (OO/2)'); | |
35 | ||
36 | is( blake2b_160("test\0test\0test\n"), pack("H*","1ccf96de0b2b8d65c6b5be215afc91c1c0526beb"), 'blake2b_160 (raw/3)'); | |
37 | is( blake2b_160_hex("test\0test\0test\n"), "1ccf96de0b2b8d65c6b5be215afc91c1c0526beb", 'blake2b_160 (hex/3)'); | |
38 | is( blake2b_160_b64("test\0test\0test\n"), "HM+W3gsrjWXGtb4hWvyRwcBSa+s=", 'blake2b_160 (base64/3)'); | |
39 | is( digest_data('BLAKE2b_160', "test\0test\0test\n"), pack("H*","1ccf96de0b2b8d65c6b5be215afc91c1c0526beb"), 'blake2b_160 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2b_160', "test\0test\0test\n"), "1ccf96de0b2b8d65c6b5be215afc91c1c0526beb", 'blake2b_160 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2b_160', "test\0test\0test\n"), "HM+W3gsrjWXGtb4hWvyRwcBSa+s=", 'blake2b_160 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2b_160', "test\0test\0test\n"), "HM-W3gsrjWXGtb4hWvyRwcBSa-s", 'blake2b_160 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2b_160->new->add("test\0test\0test\n")->hexdigest, "1ccf96de0b2b8d65c6b5be215afc91c1c0526beb", 'blake2b_160 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2b_160_file('t/data/binary-test.file'), pack("H*","f3ccc92130e0028ebca9a3a50efb2a15578d1b64"), 'blake2b_160 (raw/file/1)'); | |
47 | is( blake2b_160_file_hex('t/data/binary-test.file'), "f3ccc92130e0028ebca9a3a50efb2a15578d1b64", 'blake2b_160 (hex/file/1)'); | |
48 | is( blake2b_160_file_b64('t/data/binary-test.file'), "88zJITDgAo68qaOlDvsqFVeNG2Q=", 'blake2b_160 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2b_160', 't/data/binary-test.file'), pack("H*","f3ccc92130e0028ebca9a3a50efb2a15578d1b64"), 'blake2b_160 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2b_160', 't/data/binary-test.file'), "f3ccc92130e0028ebca9a3a50efb2a15578d1b64", 'blake2b_160 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2b_160', 't/data/binary-test.file'), "88zJITDgAo68qaOlDvsqFVeNG2Q=", 'blake2b_160 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2b_160', 't/data/binary-test.file'), "88zJITDgAo68qaOlDvsqFVeNG2Q", 'blake2b_160 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2b_160->new->addfile('t/data/binary-test.file')->hexdigest, "f3ccc92130e0028ebca9a3a50efb2a15578d1b64", 'blake2b_160 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2b_160->new->addfile($fh)->hexdigest, "f3ccc92130e0028ebca9a3a50efb2a15578d1b64", 'blake2b_160 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2b_160_file('t/data/text-CR.file'), pack("H*","206fb81fb94a6738e2829111fbd3deabc34173a3"), 'blake2b_160 (raw/file/2)'); | |
62 | is( blake2b_160_file_hex('t/data/text-CR.file'), "206fb81fb94a6738e2829111fbd3deabc34173a3", 'blake2b_160 (hex/file/2)'); | |
63 | is( blake2b_160_file_b64('t/data/text-CR.file'), "IG+4H7lKZzjigpER+9Peq8NBc6M=", 'blake2b_160 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2b_160', 't/data/text-CR.file'), pack("H*","206fb81fb94a6738e2829111fbd3deabc34173a3"), 'blake2b_160 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2b_160', 't/data/text-CR.file'), "206fb81fb94a6738e2829111fbd3deabc34173a3", 'blake2b_160 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2b_160', 't/data/text-CR.file'), "IG+4H7lKZzjigpER+9Peq8NBc6M=", 'blake2b_160 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2b_160', 't/data/text-CR.file'), "IG-4H7lKZzjigpER-9Peq8NBc6M", 'blake2b_160 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2b_160->new->addfile('t/data/text-CR.file')->hexdigest, "206fb81fb94a6738e2829111fbd3deabc34173a3", 'blake2b_160 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2b_160->new->addfile($fh)->hexdigest, "206fb81fb94a6738e2829111fbd3deabc34173a3", 'blake2b_160 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2b_160_file('t/data/text-CRLF.file'), pack("H*","a5e956dde7e949f6467d21bf58f7b26891877805"), 'blake2b_160 (raw/file/3)'); | |
77 | is( blake2b_160_file_hex('t/data/text-CRLF.file'), "a5e956dde7e949f6467d21bf58f7b26891877805", 'blake2b_160 (hex/file/3)'); | |
78 | is( blake2b_160_file_b64('t/data/text-CRLF.file'), "pelW3efpSfZGfSG/WPeyaJGHeAU=", 'blake2b_160 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2b_160', 't/data/text-CRLF.file'), pack("H*","a5e956dde7e949f6467d21bf58f7b26891877805"), 'blake2b_160 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2b_160', 't/data/text-CRLF.file'), "a5e956dde7e949f6467d21bf58f7b26891877805", 'blake2b_160 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2b_160', 't/data/text-CRLF.file'), "pelW3efpSfZGfSG/WPeyaJGHeAU=", 'blake2b_160 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2b_160', 't/data/text-CRLF.file'), "pelW3efpSfZGfSG_WPeyaJGHeAU", 'blake2b_160 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2b_160->new->addfile('t/data/text-CRLF.file')->hexdigest, "a5e956dde7e949f6467d21bf58f7b26891877805", 'blake2b_160 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2b_160->new->addfile($fh)->hexdigest, "a5e956dde7e949f6467d21bf58f7b26891877805", 'blake2b_160 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2b_160_file('t/data/text-LF.file'), pack("H*","023cb935a71ee3bf04d1b8b9b7a1d93838826f9a"), 'blake2b_160 (raw/file/4)'); | |
92 | is( blake2b_160_file_hex('t/data/text-LF.file'), "023cb935a71ee3bf04d1b8b9b7a1d93838826f9a", 'blake2b_160 (hex/file/4)'); | |
93 | is( blake2b_160_file_b64('t/data/text-LF.file'), "Ajy5Nace478E0bi5t6HZODiCb5o=", 'blake2b_160 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2b_160', 't/data/text-LF.file'), pack("H*","023cb935a71ee3bf04d1b8b9b7a1d93838826f9a"), 'blake2b_160 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2b_160', 't/data/text-LF.file'), "023cb935a71ee3bf04d1b8b9b7a1d93838826f9a", 'blake2b_160 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2b_160', 't/data/text-LF.file'), "Ajy5Nace478E0bi5t6HZODiCb5o=", 'blake2b_160 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2b_160', 't/data/text-LF.file'), "Ajy5Nace478E0bi5t6HZODiCb5o", 'blake2b_160 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2b_160->new->addfile('t/data/text-LF.file')->hexdigest, "023cb935a71ee3bf04d1b8b9b7a1d93838826f9a", 'blake2b_160 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2b_160->new->addfile($fh)->hexdigest, "023cb935a71ee3bf04d1b8b9b7a1d93838826f9a", 'blake2b_160 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2b_256 qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2b_256'), 32, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2b_256'), 32, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2b_256::hashsize, 32, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2b_256->hashsize, 32, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2b_256')->hashsize, 32, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2b_256->new->hashsize, 32, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2b_256(""), pack("H*","0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8"), 'blake2b_256 (raw/1)'); | |
19 | is( blake2b_256_hex(""), "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8", 'blake2b_256 (hex/1)'); | |
20 | is( blake2b_256_b64(""), "DldRwCblQ7Loqy6wYJnaodHl30d3j3eH+qtFzfEv46g=", 'blake2b_256 (base64/1)'); | |
21 | is( digest_data('BLAKE2b_256', ""), pack("H*","0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8"), 'blake2b_256 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2b_256', ""), "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8", 'blake2b_256 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2b_256', ""), "DldRwCblQ7Loqy6wYJnaodHl30d3j3eH+qtFzfEv46g=", 'blake2b_256 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2b_256', ""), "DldRwCblQ7Loqy6wYJnaodHl30d3j3eH-qtFzfEv46g", 'blake2b_256 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2b_256->new->add("")->hexdigest, "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8", 'blake2b_256 (OO/1)'); | |
26 | ||
27 | is( blake2b_256("123"), pack("H*","f5d67bae73b0e10d0dfd3043b3f4f100ada014c5c37bd5ce97813b13f5ab2bcf"), 'blake2b_256 (raw/2)'); | |
28 | is( blake2b_256_hex("123"), "f5d67bae73b0e10d0dfd3043b3f4f100ada014c5c37bd5ce97813b13f5ab2bcf", 'blake2b_256 (hex/2)'); | |
29 | is( blake2b_256_b64("123"), "9dZ7rnOw4Q0N/TBDs/TxAK2gFMXDe9XOl4E7E/WrK88=", 'blake2b_256 (base64/2)'); | |
30 | is( digest_data('BLAKE2b_256', "123"), pack("H*","f5d67bae73b0e10d0dfd3043b3f4f100ada014c5c37bd5ce97813b13f5ab2bcf"), 'blake2b_256 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2b_256', "123"), "f5d67bae73b0e10d0dfd3043b3f4f100ada014c5c37bd5ce97813b13f5ab2bcf", 'blake2b_256 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2b_256', "123"), "9dZ7rnOw4Q0N/TBDs/TxAK2gFMXDe9XOl4E7E/WrK88=", 'blake2b_256 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2b_256', "123"), "9dZ7rnOw4Q0N_TBDs_TxAK2gFMXDe9XOl4E7E_WrK88", 'blake2b_256 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2b_256->new->add("123")->hexdigest, "f5d67bae73b0e10d0dfd3043b3f4f100ada014c5c37bd5ce97813b13f5ab2bcf", 'blake2b_256 (OO/2)'); | |
35 | ||
36 | is( blake2b_256("test\0test\0test\n"), pack("H*","22d4e56794002cce9ecc0b1c2a67d41a514024c76a626ba570a5ec0d6c572ee3"), 'blake2b_256 (raw/3)'); | |
37 | is( blake2b_256_hex("test\0test\0test\n"), "22d4e56794002cce9ecc0b1c2a67d41a514024c76a626ba570a5ec0d6c572ee3", 'blake2b_256 (hex/3)'); | |
38 | is( blake2b_256_b64("test\0test\0test\n"), "ItTlZ5QALM6ezAscKmfUGlFAJMdqYmulcKXsDWxXLuM=", 'blake2b_256 (base64/3)'); | |
39 | is( digest_data('BLAKE2b_256', "test\0test\0test\n"), pack("H*","22d4e56794002cce9ecc0b1c2a67d41a514024c76a626ba570a5ec0d6c572ee3"), 'blake2b_256 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2b_256', "test\0test\0test\n"), "22d4e56794002cce9ecc0b1c2a67d41a514024c76a626ba570a5ec0d6c572ee3", 'blake2b_256 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2b_256', "test\0test\0test\n"), "ItTlZ5QALM6ezAscKmfUGlFAJMdqYmulcKXsDWxXLuM=", 'blake2b_256 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2b_256', "test\0test\0test\n"), "ItTlZ5QALM6ezAscKmfUGlFAJMdqYmulcKXsDWxXLuM", 'blake2b_256 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2b_256->new->add("test\0test\0test\n")->hexdigest, "22d4e56794002cce9ecc0b1c2a67d41a514024c76a626ba570a5ec0d6c572ee3", 'blake2b_256 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2b_256_file('t/data/binary-test.file'), pack("H*","34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b"), 'blake2b_256 (raw/file/1)'); | |
47 | is( blake2b_256_file_hex('t/data/binary-test.file'), "34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b", 'blake2b_256 (hex/file/1)'); | |
48 | is( blake2b_256_file_b64('t/data/binary-test.file'), "NMsoezWbC+A3WrbP7vrJ+Hv1dwEXzKlQpfLWbkXbx3s=", 'blake2b_256 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2b_256', 't/data/binary-test.file'), pack("H*","34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b"), 'blake2b_256 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2b_256', 't/data/binary-test.file'), "34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b", 'blake2b_256 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2b_256', 't/data/binary-test.file'), "NMsoezWbC+A3WrbP7vrJ+Hv1dwEXzKlQpfLWbkXbx3s=", 'blake2b_256 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2b_256', 't/data/binary-test.file'), "NMsoezWbC-A3WrbP7vrJ-Hv1dwEXzKlQpfLWbkXbx3s", 'blake2b_256 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2b_256->new->addfile('t/data/binary-test.file')->hexdigest, "34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b", 'blake2b_256 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2b_256->new->addfile($fh)->hexdigest, "34cb287b359b0be0375ab6cfeefac9f87bf5770117cca950a5f2d66e45dbc77b", 'blake2b_256 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2b_256_file('t/data/text-CR.file'), pack("H*","8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3"), 'blake2b_256 (raw/file/2)'); | |
62 | is( blake2b_256_file_hex('t/data/text-CR.file'), "8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3", 'blake2b_256 (hex/file/2)'); | |
63 | is( blake2b_256_file_b64('t/data/text-CR.file'), "jd5ODKdjNJnAkT19XG01JDB8TuOBkx9MwsPXAwq5erM=", 'blake2b_256 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2b_256', 't/data/text-CR.file'), pack("H*","8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3"), 'blake2b_256 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2b_256', 't/data/text-CR.file'), "8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3", 'blake2b_256 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2b_256', 't/data/text-CR.file'), "jd5ODKdjNJnAkT19XG01JDB8TuOBkx9MwsPXAwq5erM=", 'blake2b_256 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2b_256', 't/data/text-CR.file'), "jd5ODKdjNJnAkT19XG01JDB8TuOBkx9MwsPXAwq5erM", 'blake2b_256 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2b_256->new->addfile('t/data/text-CR.file')->hexdigest, "8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3", 'blake2b_256 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2b_256->new->addfile($fh)->hexdigest, "8dde4e0ca7633499c0913d7d5c6d3524307c4ee381931f4cc2c3d7030ab97ab3", 'blake2b_256 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2b_256_file('t/data/text-CRLF.file'), pack("H*","3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22"), 'blake2b_256 (raw/file/3)'); | |
77 | is( blake2b_256_file_hex('t/data/text-CRLF.file'), "3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22", 'blake2b_256 (hex/file/3)'); | |
78 | is( blake2b_256_file_b64('t/data/text-CRLF.file'), "Pm3N25278eo51VyYDaAZccaxvSB24LvIyVykmDaSaiI=", 'blake2b_256 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2b_256', 't/data/text-CRLF.file'), pack("H*","3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22"), 'blake2b_256 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2b_256', 't/data/text-CRLF.file'), "3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22", 'blake2b_256 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2b_256', 't/data/text-CRLF.file'), "Pm3N25278eo51VyYDaAZccaxvSB24LvIyVykmDaSaiI=", 'blake2b_256 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2b_256', 't/data/text-CRLF.file'), "Pm3N25278eo51VyYDaAZccaxvSB24LvIyVykmDaSaiI", 'blake2b_256 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2b_256->new->addfile('t/data/text-CRLF.file')->hexdigest, "3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22", 'blake2b_256 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2b_256->new->addfile($fh)->hexdigest, "3e6dcddb9dbbf1ea39d55c980da01971c6b1bd2076e0bbc8c95ca49836926a22", 'blake2b_256 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2b_256_file('t/data/text-LF.file'), pack("H*","2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e"), 'blake2b_256 (raw/file/4)'); | |
92 | is( blake2b_256_file_hex('t/data/text-LF.file'), "2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e", 'blake2b_256 (hex/file/4)'); | |
93 | is( blake2b_256_file_b64('t/data/text-LF.file'), "LxA4QDBGCaFryixzTjxgS3I/9RZFebaoCCX4ONfgxn4=", 'blake2b_256 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2b_256', 't/data/text-LF.file'), pack("H*","2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e"), 'blake2b_256 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2b_256', 't/data/text-LF.file'), "2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e", 'blake2b_256 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2b_256', 't/data/text-LF.file'), "LxA4QDBGCaFryixzTjxgS3I/9RZFebaoCCX4ONfgxn4=", 'blake2b_256 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2b_256', 't/data/text-LF.file'), "LxA4QDBGCaFryixzTjxgS3I_9RZFebaoCCX4ONfgxn4", 'blake2b_256 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2b_256->new->addfile('t/data/text-LF.file')->hexdigest, "2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e", 'blake2b_256 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2b_256->new->addfile($fh)->hexdigest, "2f103840304609a16bca2c734e3c604b723ff5164579b6a80825f838d7e0c67e", 'blake2b_256 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2b_384 qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2b_384'), 48, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2b_384'), 48, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2b_384::hashsize, 48, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2b_384->hashsize, 48, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2b_384')->hashsize, 48, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2b_384->new->hashsize, 48, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2b_384(""), pack("H*","b32811423377f52d7862286ee1a72ee540524380fda1724a6f25d7978c6fd3244a6caf0498812673c5e05ef583825100"), 'blake2b_384 (raw/1)'); | |
19 | is( blake2b_384_hex(""), "b32811423377f52d7862286ee1a72ee540524380fda1724a6f25d7978c6fd3244a6caf0498812673c5e05ef583825100", 'blake2b_384 (hex/1)'); | |
20 | is( blake2b_384_b64(""), "sygRQjN39S14Yihu4acu5UBSQ4D9oXJKbyXXl4xv0yRKbK8EmIEmc8XgXvWDglEA", 'blake2b_384 (base64/1)'); | |
21 | is( digest_data('BLAKE2b_384', ""), pack("H*","b32811423377f52d7862286ee1a72ee540524380fda1724a6f25d7978c6fd3244a6caf0498812673c5e05ef583825100"), 'blake2b_384 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2b_384', ""), "b32811423377f52d7862286ee1a72ee540524380fda1724a6f25d7978c6fd3244a6caf0498812673c5e05ef583825100", 'blake2b_384 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2b_384', ""), "sygRQjN39S14Yihu4acu5UBSQ4D9oXJKbyXXl4xv0yRKbK8EmIEmc8XgXvWDglEA", 'blake2b_384 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2b_384', ""), "sygRQjN39S14Yihu4acu5UBSQ4D9oXJKbyXXl4xv0yRKbK8EmIEmc8XgXvWDglEA", 'blake2b_384 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2b_384->new->add("")->hexdigest, "b32811423377f52d7862286ee1a72ee540524380fda1724a6f25d7978c6fd3244a6caf0498812673c5e05ef583825100", 'blake2b_384 (OO/1)'); | |
26 | ||
27 | is( blake2b_384("123"), pack("H*","50af7f5deca52771b287704c66e79479adc0ec91a380279ab05627eb4c050f13494beb28dfc739a2a1a7194f9d1c30b0"), 'blake2b_384 (raw/2)'); | |
28 | is( blake2b_384_hex("123"), "50af7f5deca52771b287704c66e79479adc0ec91a380279ab05627eb4c050f13494beb28dfc739a2a1a7194f9d1c30b0", 'blake2b_384 (hex/2)'); | |
29 | is( blake2b_384_b64("123"), "UK9/XeylJ3Gyh3BMZueUea3A7JGjgCeasFYn60wFDxNJS+so38c5oqGnGU+dHDCw", 'blake2b_384 (base64/2)'); | |
30 | is( digest_data('BLAKE2b_384', "123"), pack("H*","50af7f5deca52771b287704c66e79479adc0ec91a380279ab05627eb4c050f13494beb28dfc739a2a1a7194f9d1c30b0"), 'blake2b_384 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2b_384', "123"), "50af7f5deca52771b287704c66e79479adc0ec91a380279ab05627eb4c050f13494beb28dfc739a2a1a7194f9d1c30b0", 'blake2b_384 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2b_384', "123"), "UK9/XeylJ3Gyh3BMZueUea3A7JGjgCeasFYn60wFDxNJS+so38c5oqGnGU+dHDCw", 'blake2b_384 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2b_384', "123"), "UK9_XeylJ3Gyh3BMZueUea3A7JGjgCeasFYn60wFDxNJS-so38c5oqGnGU-dHDCw", 'blake2b_384 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2b_384->new->add("123")->hexdigest, "50af7f5deca52771b287704c66e79479adc0ec91a380279ab05627eb4c050f13494beb28dfc739a2a1a7194f9d1c30b0", 'blake2b_384 (OO/2)'); | |
35 | ||
36 | is( blake2b_384("test\0test\0test\n"), pack("H*","42788332987449000fd8deeec86645ed2c2986fc2338f3defdb4dd48681ad5eb6a92823516a74093288673922f19c669"), 'blake2b_384 (raw/3)'); | |
37 | is( blake2b_384_hex("test\0test\0test\n"), "42788332987449000fd8deeec86645ed2c2986fc2338f3defdb4dd48681ad5eb6a92823516a74093288673922f19c669", 'blake2b_384 (hex/3)'); | |
38 | is( blake2b_384_b64("test\0test\0test\n"), "QniDMph0SQAP2N7uyGZF7SwphvwjOPPe/bTdSGga1etqkoI1FqdAkyiGc5IvGcZp", 'blake2b_384 (base64/3)'); | |
39 | is( digest_data('BLAKE2b_384', "test\0test\0test\n"), pack("H*","42788332987449000fd8deeec86645ed2c2986fc2338f3defdb4dd48681ad5eb6a92823516a74093288673922f19c669"), 'blake2b_384 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2b_384', "test\0test\0test\n"), "42788332987449000fd8deeec86645ed2c2986fc2338f3defdb4dd48681ad5eb6a92823516a74093288673922f19c669", 'blake2b_384 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2b_384', "test\0test\0test\n"), "QniDMph0SQAP2N7uyGZF7SwphvwjOPPe/bTdSGga1etqkoI1FqdAkyiGc5IvGcZp", 'blake2b_384 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2b_384', "test\0test\0test\n"), "QniDMph0SQAP2N7uyGZF7SwphvwjOPPe_bTdSGga1etqkoI1FqdAkyiGc5IvGcZp", 'blake2b_384 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2b_384->new->add("test\0test\0test\n")->hexdigest, "42788332987449000fd8deeec86645ed2c2986fc2338f3defdb4dd48681ad5eb6a92823516a74093288673922f19c669", 'blake2b_384 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2b_384_file('t/data/binary-test.file'), pack("H*","8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239"), 'blake2b_384 (raw/file/1)'); | |
47 | is( blake2b_384_file_hex('t/data/binary-test.file'), "8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239", 'blake2b_384 (hex/file/1)'); | |
48 | is( blake2b_384_file_b64('t/data/binary-test.file'), "hRRVahYvvBl9CUy4Tr86f2UTe8yI5IBGMawyEoZh9wRXQHMAUAzVJ+E7MN+aFnI5", 'blake2b_384 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2b_384', 't/data/binary-test.file'), pack("H*","8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239"), 'blake2b_384 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2b_384', 't/data/binary-test.file'), "8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239", 'blake2b_384 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2b_384', 't/data/binary-test.file'), "hRRVahYvvBl9CUy4Tr86f2UTe8yI5IBGMawyEoZh9wRXQHMAUAzVJ+E7MN+aFnI5", 'blake2b_384 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2b_384', 't/data/binary-test.file'), "hRRVahYvvBl9CUy4Tr86f2UTe8yI5IBGMawyEoZh9wRXQHMAUAzVJ-E7MN-aFnI5", 'blake2b_384 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2b_384->new->addfile('t/data/binary-test.file')->hexdigest, "8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239", 'blake2b_384 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2b_384->new->addfile($fh)->hexdigest, "8514556a162fbc197d094cb84ebf3a7f65137bcc88e4804631ac32128661f70457407300500cd527e13b30df9a167239", 'blake2b_384 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2b_384_file('t/data/text-CR.file'), pack("H*","dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386"), 'blake2b_384 (raw/file/2)'); | |
62 | is( blake2b_384_file_hex('t/data/text-CR.file'), "dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386", 'blake2b_384 (hex/file/2)'); | |
63 | is( blake2b_384_file_b64('t/data/text-CR.file'), "2tZoTPZccrHUSvwuEhVCoBlUYxsDnn/fZjt5drlTmzeaxYADzaiM76z8h7kkJBOG", 'blake2b_384 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2b_384', 't/data/text-CR.file'), pack("H*","dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386"), 'blake2b_384 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2b_384', 't/data/text-CR.file'), "dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386", 'blake2b_384 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2b_384', 't/data/text-CR.file'), "2tZoTPZccrHUSvwuEhVCoBlUYxsDnn/fZjt5drlTmzeaxYADzaiM76z8h7kkJBOG", 'blake2b_384 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2b_384', 't/data/text-CR.file'), "2tZoTPZccrHUSvwuEhVCoBlUYxsDnn_fZjt5drlTmzeaxYADzaiM76z8h7kkJBOG", 'blake2b_384 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2b_384->new->addfile('t/data/text-CR.file')->hexdigest, "dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386", 'blake2b_384 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2b_384->new->addfile($fh)->hexdigest, "dad6684cf65c72b1d44afc2e121542a01954631b039e7fdf663b7976b9539b379ac58003cda88cefacfc87b924241386", 'blake2b_384 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2b_384_file('t/data/text-CRLF.file'), pack("H*","c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17"), 'blake2b_384 (raw/file/3)'); | |
77 | is( blake2b_384_file_hex('t/data/text-CRLF.file'), "c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17", 'blake2b_384 (hex/file/3)'); | |
78 | is( blake2b_384_file_b64('t/data/text-CRLF.file'), "wno+ZcxT0v9RQdfRWRhpPLog2N6LkdB1qcWgZqyBsATgM9BctLbIJX2093APMhoX", 'blake2b_384 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2b_384', 't/data/text-CRLF.file'), pack("H*","c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17"), 'blake2b_384 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2b_384', 't/data/text-CRLF.file'), "c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17", 'blake2b_384 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2b_384', 't/data/text-CRLF.file'), "wno+ZcxT0v9RQdfRWRhpPLog2N6LkdB1qcWgZqyBsATgM9BctLbIJX2093APMhoX", 'blake2b_384 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2b_384', 't/data/text-CRLF.file'), "wno-ZcxT0v9RQdfRWRhpPLog2N6LkdB1qcWgZqyBsATgM9BctLbIJX2093APMhoX", 'blake2b_384 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2b_384->new->addfile('t/data/text-CRLF.file')->hexdigest, "c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17", 'blake2b_384 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2b_384->new->addfile($fh)->hexdigest, "c27a3e65cc53d2ff5141d7d15918693cba20d8de8b91d075a9c5a066ac81b004e033d05cb4b6c8257db4f7700f321a17", 'blake2b_384 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2b_384_file('t/data/text-LF.file'), pack("H*","6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe"), 'blake2b_384 (raw/file/4)'); | |
92 | is( blake2b_384_file_hex('t/data/text-LF.file'), "6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe", 'blake2b_384 (hex/file/4)'); | |
93 | is( blake2b_384_file_b64('t/data/text-LF.file'), "YSbPFmm71Yb1Sfdr213PFquTwzk+TLcSUkVQxDwQBioiyBeWd/RjeCvL4wLbavq+", 'blake2b_384 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2b_384', 't/data/text-LF.file'), pack("H*","6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe"), 'blake2b_384 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2b_384', 't/data/text-LF.file'), "6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe", 'blake2b_384 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2b_384', 't/data/text-LF.file'), "YSbPFmm71Yb1Sfdr213PFquTwzk+TLcSUkVQxDwQBioiyBeWd/RjeCvL4wLbavq+", 'blake2b_384 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2b_384', 't/data/text-LF.file'), "YSbPFmm71Yb1Sfdr213PFquTwzk-TLcSUkVQxDwQBioiyBeWd_RjeCvL4wLbavq-", 'blake2b_384 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2b_384->new->addfile('t/data/text-LF.file')->hexdigest, "6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe", 'blake2b_384 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2b_384->new->addfile($fh)->hexdigest, "6126cf1669bbd586f549f76bdb5dcf16ab93c3393e4cb712524550c43c10062a22c8179677f463782bcbe302db6afabe", 'blake2b_384 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2b_512 qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2b_512'), 64, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2b_512'), 64, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2b_512::hashsize, 64, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2b_512->hashsize, 64, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2b_512')->hashsize, 64, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2b_512->new->hashsize, 64, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2b_512(""), pack("H*","786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce"), 'blake2b_512 (raw/1)'); | |
19 | is( blake2b_512_hex(""), "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce", 'blake2b_512 (hex/1)'); | |
20 | is( blake2b_512_b64(""), "eGoC90IBWQPGxv2FJVLScpEvR0DhWEdhiobiF/cfVBnSXhAxr+5YUxOJZESTTrBLkDpoWxRIt1XVb3Aa/pvizg==", 'blake2b_512 (base64/1)'); | |
21 | is( digest_data('BLAKE2b_512', ""), pack("H*","786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce"), 'blake2b_512 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2b_512', ""), "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce", 'blake2b_512 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2b_512', ""), "eGoC90IBWQPGxv2FJVLScpEvR0DhWEdhiobiF/cfVBnSXhAxr+5YUxOJZESTTrBLkDpoWxRIt1XVb3Aa/pvizg==", 'blake2b_512 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2b_512', ""), "eGoC90IBWQPGxv2FJVLScpEvR0DhWEdhiobiF_cfVBnSXhAxr-5YUxOJZESTTrBLkDpoWxRIt1XVb3Aa_pvizg", 'blake2b_512 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2b_512->new->add("")->hexdigest, "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce", 'blake2b_512 (OO/1)'); | |
26 | ||
27 | is( blake2b_512("123"), pack("H*","e64cb91c7c1819bdcda4dca47a2aae98e737df75ddb0287083229dc0695064616df676a0c95ae55109fe0a27ba9dee79ea9a5c9d90cceb0cf8ae80b4f61ab4a3"), 'blake2b_512 (raw/2)'); | |
28 | is( blake2b_512_hex("123"), "e64cb91c7c1819bdcda4dca47a2aae98e737df75ddb0287083229dc0695064616df676a0c95ae55109fe0a27ba9dee79ea9a5c9d90cceb0cf8ae80b4f61ab4a3", 'blake2b_512 (hex/2)'); | |
29 | is( blake2b_512_b64("123"), "5ky5HHwYGb3NpNykeiqumOc333XdsChwgyKdwGlQZGFt9nagyVrlUQn+Cie6ne556ppcnZDM6wz4roC09hq0ow==", 'blake2b_512 (base64/2)'); | |
30 | is( digest_data('BLAKE2b_512', "123"), pack("H*","e64cb91c7c1819bdcda4dca47a2aae98e737df75ddb0287083229dc0695064616df676a0c95ae55109fe0a27ba9dee79ea9a5c9d90cceb0cf8ae80b4f61ab4a3"), 'blake2b_512 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2b_512', "123"), "e64cb91c7c1819bdcda4dca47a2aae98e737df75ddb0287083229dc0695064616df676a0c95ae55109fe0a27ba9dee79ea9a5c9d90cceb0cf8ae80b4f61ab4a3", 'blake2b_512 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2b_512', "123"), "5ky5HHwYGb3NpNykeiqumOc333XdsChwgyKdwGlQZGFt9nagyVrlUQn+Cie6ne556ppcnZDM6wz4roC09hq0ow==", 'blake2b_512 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2b_512', "123"), "5ky5HHwYGb3NpNykeiqumOc333XdsChwgyKdwGlQZGFt9nagyVrlUQn-Cie6ne556ppcnZDM6wz4roC09hq0ow", 'blake2b_512 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2b_512->new->add("123")->hexdigest, "e64cb91c7c1819bdcda4dca47a2aae98e737df75ddb0287083229dc0695064616df676a0c95ae55109fe0a27ba9dee79ea9a5c9d90cceb0cf8ae80b4f61ab4a3", 'blake2b_512 (OO/2)'); | |
35 | ||
36 | is( blake2b_512("test\0test\0test\n"), pack("H*","fd8d99f76c34c8c6ad60d7842ed769a9d32dc619efc8618761db5a8f1851089b8adfaf40f73ac5f0acf75307bbeda9769764c386e715cc758ce0ee6dfe184400"), 'blake2b_512 (raw/3)'); | |
37 | is( blake2b_512_hex("test\0test\0test\n"), "fd8d99f76c34c8c6ad60d7842ed769a9d32dc619efc8618761db5a8f1851089b8adfaf40f73ac5f0acf75307bbeda9769764c386e715cc758ce0ee6dfe184400", 'blake2b_512 (hex/3)'); | |
38 | is( blake2b_512_b64("test\0test\0test\n"), "/Y2Z92w0yMatYNeELtdpqdMtxhnvyGGHYdtajxhRCJuK369A9zrF8Kz3Uwe77al2l2TDhucVzHWM4O5t/hhEAA==", 'blake2b_512 (base64/3)'); | |
39 | is( digest_data('BLAKE2b_512', "test\0test\0test\n"), pack("H*","fd8d99f76c34c8c6ad60d7842ed769a9d32dc619efc8618761db5a8f1851089b8adfaf40f73ac5f0acf75307bbeda9769764c386e715cc758ce0ee6dfe184400"), 'blake2b_512 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2b_512', "test\0test\0test\n"), "fd8d99f76c34c8c6ad60d7842ed769a9d32dc619efc8618761db5a8f1851089b8adfaf40f73ac5f0acf75307bbeda9769764c386e715cc758ce0ee6dfe184400", 'blake2b_512 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2b_512', "test\0test\0test\n"), "/Y2Z92w0yMatYNeELtdpqdMtxhnvyGGHYdtajxhRCJuK369A9zrF8Kz3Uwe77al2l2TDhucVzHWM4O5t/hhEAA==", 'blake2b_512 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2b_512', "test\0test\0test\n"), "_Y2Z92w0yMatYNeELtdpqdMtxhnvyGGHYdtajxhRCJuK369A9zrF8Kz3Uwe77al2l2TDhucVzHWM4O5t_hhEAA", 'blake2b_512 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2b_512->new->add("test\0test\0test\n")->hexdigest, "fd8d99f76c34c8c6ad60d7842ed769a9d32dc619efc8618761db5a8f1851089b8adfaf40f73ac5f0acf75307bbeda9769764c386e715cc758ce0ee6dfe184400", 'blake2b_512 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2b_512_file('t/data/binary-test.file'), pack("H*","4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b"), 'blake2b_512 (raw/file/1)'); | |
47 | is( blake2b_512_file_hex('t/data/binary-test.file'), "4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b", 'blake2b_512 (hex/file/1)'); | |
48 | is( blake2b_512_file_b64('t/data/binary-test.file'), "S+EBpFveN4XAafeWc+EYmo2dyqJIKg/eDCzHWAeqg/Pg03R2kvCbZwisAKPGQpALD4vGTx57zkDAQ+rq6Fg8Cw==", 'blake2b_512 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2b_512', 't/data/binary-test.file'), pack("H*","4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b"), 'blake2b_512 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2b_512', 't/data/binary-test.file'), "4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b", 'blake2b_512 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2b_512', 't/data/binary-test.file'), "S+EBpFveN4XAafeWc+EYmo2dyqJIKg/eDCzHWAeqg/Pg03R2kvCbZwisAKPGQpALD4vGTx57zkDAQ+rq6Fg8Cw==", 'blake2b_512 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2b_512', 't/data/binary-test.file'), "S-EBpFveN4XAafeWc-EYmo2dyqJIKg_eDCzHWAeqg_Pg03R2kvCbZwisAKPGQpALD4vGTx57zkDAQ-rq6Fg8Cw", 'blake2b_512 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2b_512->new->addfile('t/data/binary-test.file')->hexdigest, "4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b", 'blake2b_512 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2b_512->new->addfile($fh)->hexdigest, "4be101a45bde3785c069f79673e1189a8d9dcaa2482a0fde0c2cc75807aa83f3e0d3747692f09b6708ac00a3c642900b0f8bc64f1e7bce40c043eaeae8583c0b", 'blake2b_512 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2b_512_file('t/data/text-CR.file'), pack("H*","49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c"), 'blake2b_512 (raw/file/2)'); | |
62 | is( blake2b_512_file_hex('t/data/text-CR.file'), "49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c", 'blake2b_512 (hex/file/2)'); | |
63 | is( blake2b_512_file_b64('t/data/text-CR.file'), "SaWmMtboPTl47lpYPYGvjpUE+uSGH2gOWnJYuy6tXUTIoLaxlPIaxoMowcYrjtIwJeXWRnTQUr+bFx6IQYyhbA==", 'blake2b_512 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2b_512', 't/data/text-CR.file'), pack("H*","49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c"), 'blake2b_512 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2b_512', 't/data/text-CR.file'), "49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c", 'blake2b_512 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2b_512', 't/data/text-CR.file'), "SaWmMtboPTl47lpYPYGvjpUE+uSGH2gOWnJYuy6tXUTIoLaxlPIaxoMowcYrjtIwJeXWRnTQUr+bFx6IQYyhbA==", 'blake2b_512 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2b_512', 't/data/text-CR.file'), "SaWmMtboPTl47lpYPYGvjpUE-uSGH2gOWnJYuy6tXUTIoLaxlPIaxoMowcYrjtIwJeXWRnTQUr-bFx6IQYyhbA", 'blake2b_512 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2b_512->new->addfile('t/data/text-CR.file')->hexdigest, "49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c", 'blake2b_512 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2b_512->new->addfile($fh)->hexdigest, "49a5a632d6e83d3978ee5a583d81af8e9504fae4861f680e5a7258bb2ead5d44c8a0b6b194f21ac68328c1c62b8ed23025e5d64674d052bf9b171e88418ca16c", 'blake2b_512 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2b_512_file('t/data/text-CRLF.file'), pack("H*","5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e"), 'blake2b_512 (raw/file/3)'); | |
77 | is( blake2b_512_file_hex('t/data/text-CRLF.file'), "5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e", 'blake2b_512 (hex/file/3)'); | |
78 | is( blake2b_512_file_b64('t/data/text-CRLF.file'), "XfJgbt9lCK6Sfm0Pt2mr7UxdyC+Zwuj52hxSwNC8PDJURrPLTUf/xonQGpZ2eDlG3UoTK848Maj6/S7rJxB6fg==", 'blake2b_512 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2b_512', 't/data/text-CRLF.file'), pack("H*","5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e"), 'blake2b_512 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2b_512', 't/data/text-CRLF.file'), "5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e", 'blake2b_512 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2b_512', 't/data/text-CRLF.file'), "XfJgbt9lCK6Sfm0Pt2mr7UxdyC+Zwuj52hxSwNC8PDJURrPLTUf/xonQGpZ2eDlG3UoTK848Maj6/S7rJxB6fg==", 'blake2b_512 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2b_512', 't/data/text-CRLF.file'), "XfJgbt9lCK6Sfm0Pt2mr7UxdyC-Zwuj52hxSwNC8PDJURrPLTUf_xonQGpZ2eDlG3UoTK848Maj6_S7rJxB6fg", 'blake2b_512 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2b_512->new->addfile('t/data/text-CRLF.file')->hexdigest, "5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e", 'blake2b_512 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2b_512->new->addfile($fh)->hexdigest, "5df2606edf6508ae927e6d0fb769abed4c5dc82f99c2e8f9da1c52c0d0bc3c325446b3cb4d47ffc689d01a9676783946dd4a132bce3c31a8fafd2eeb27107a7e", 'blake2b_512 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2b_512_file('t/data/text-LF.file'), pack("H*","adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e"), 'blake2b_512 (raw/file/4)'); | |
92 | is( blake2b_512_file_hex('t/data/text-LF.file'), "adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e", 'blake2b_512 (hex/file/4)'); | |
93 | is( blake2b_512_file_b64('t/data/text-LF.file'), "rapC8znVARH9QHrVw/LCe4HYVg6xKD9po0SaWagBYXyYABpUOWwJVzSiKZBfKqTf+q9c7KB3o6VZYMZgiekwng==", 'blake2b_512 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2b_512', 't/data/text-LF.file'), pack("H*","adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e"), 'blake2b_512 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2b_512', 't/data/text-LF.file'), "adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e", 'blake2b_512 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2b_512', 't/data/text-LF.file'), "rapC8znVARH9QHrVw/LCe4HYVg6xKD9po0SaWagBYXyYABpUOWwJVzSiKZBfKqTf+q9c7KB3o6VZYMZgiekwng==", 'blake2b_512 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2b_512', 't/data/text-LF.file'), "rapC8znVARH9QHrVw_LCe4HYVg6xKD9po0SaWagBYXyYABpUOWwJVzSiKZBfKqTf-q9c7KB3o6VZYMZgiekwng", 'blake2b_512 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2b_512->new->addfile('t/data/text-LF.file')->hexdigest, "adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e", 'blake2b_512 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2b_512->new->addfile($fh)->hexdigest, "adaa42f339d50111fd407ad5c3f2c27b81d8560eb1283f69a3449a59a801617c98001a54396c095734a229905f2aa4dffaaf5ceca077a3a55960c66089e9309e", 'blake2b_512 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2s_128 qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2s_128'), 16, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2s_128'), 16, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2s_128::hashsize, 16, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2s_128->hashsize, 16, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2s_128')->hashsize, 16, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2s_128->new->hashsize, 16, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2s_128(""), pack("H*","64550d6ffe2c0a01a14aba1eade0200c"), 'blake2s_128 (raw/1)'); | |
19 | is( blake2s_128_hex(""), "64550d6ffe2c0a01a14aba1eade0200c", 'blake2s_128 (hex/1)'); | |
20 | is( blake2s_128_b64(""), "ZFUNb/4sCgGhSroereAgDA==", 'blake2s_128 (base64/1)'); | |
21 | is( digest_data('BLAKE2s_128', ""), pack("H*","64550d6ffe2c0a01a14aba1eade0200c"), 'blake2s_128 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2s_128', ""), "64550d6ffe2c0a01a14aba1eade0200c", 'blake2s_128 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2s_128', ""), "ZFUNb/4sCgGhSroereAgDA==", 'blake2s_128 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2s_128', ""), "ZFUNb_4sCgGhSroereAgDA", 'blake2s_128 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2s_128->new->add("")->hexdigest, "64550d6ffe2c0a01a14aba1eade0200c", 'blake2s_128 (OO/1)'); | |
26 | ||
27 | is( blake2s_128("123"), pack("H*","0a0c4b61b07a608b3904949a4998f8b1"), 'blake2s_128 (raw/2)'); | |
28 | is( blake2s_128_hex("123"), "0a0c4b61b07a608b3904949a4998f8b1", 'blake2s_128 (hex/2)'); | |
29 | is( blake2s_128_b64("123"), "CgxLYbB6YIs5BJSaSZj4sQ==", 'blake2s_128 (base64/2)'); | |
30 | is( digest_data('BLAKE2s_128', "123"), pack("H*","0a0c4b61b07a608b3904949a4998f8b1"), 'blake2s_128 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2s_128', "123"), "0a0c4b61b07a608b3904949a4998f8b1", 'blake2s_128 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2s_128', "123"), "CgxLYbB6YIs5BJSaSZj4sQ==", 'blake2s_128 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2s_128', "123"), "CgxLYbB6YIs5BJSaSZj4sQ", 'blake2s_128 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2s_128->new->add("123")->hexdigest, "0a0c4b61b07a608b3904949a4998f8b1", 'blake2s_128 (OO/2)'); | |
35 | ||
36 | is( blake2s_128("test\0test\0test\n"), pack("H*","32aa3dfdb8adb174cab17a2ac7c205a8"), 'blake2s_128 (raw/3)'); | |
37 | is( blake2s_128_hex("test\0test\0test\n"), "32aa3dfdb8adb174cab17a2ac7c205a8", 'blake2s_128 (hex/3)'); | |
38 | is( blake2s_128_b64("test\0test\0test\n"), "Mqo9/bitsXTKsXoqx8IFqA==", 'blake2s_128 (base64/3)'); | |
39 | is( digest_data('BLAKE2s_128', "test\0test\0test\n"), pack("H*","32aa3dfdb8adb174cab17a2ac7c205a8"), 'blake2s_128 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2s_128', "test\0test\0test\n"), "32aa3dfdb8adb174cab17a2ac7c205a8", 'blake2s_128 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2s_128', "test\0test\0test\n"), "Mqo9/bitsXTKsXoqx8IFqA==", 'blake2s_128 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2s_128', "test\0test\0test\n"), "Mqo9_bitsXTKsXoqx8IFqA", 'blake2s_128 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2s_128->new->add("test\0test\0test\n")->hexdigest, "32aa3dfdb8adb174cab17a2ac7c205a8", 'blake2s_128 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2s_128_file('t/data/binary-test.file'), pack("H*","b5a4e21a67fdd4f2d75ab779feb83bfc"), 'blake2s_128 (raw/file/1)'); | |
47 | is( blake2s_128_file_hex('t/data/binary-test.file'), "b5a4e21a67fdd4f2d75ab779feb83bfc", 'blake2s_128 (hex/file/1)'); | |
48 | is( blake2s_128_file_b64('t/data/binary-test.file'), "taTiGmf91PLXWrd5/rg7/A==", 'blake2s_128 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2s_128', 't/data/binary-test.file'), pack("H*","b5a4e21a67fdd4f2d75ab779feb83bfc"), 'blake2s_128 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2s_128', 't/data/binary-test.file'), "b5a4e21a67fdd4f2d75ab779feb83bfc", 'blake2s_128 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2s_128', 't/data/binary-test.file'), "taTiGmf91PLXWrd5/rg7/A==", 'blake2s_128 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2s_128', 't/data/binary-test.file'), "taTiGmf91PLXWrd5_rg7_A", 'blake2s_128 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2s_128->new->addfile('t/data/binary-test.file')->hexdigest, "b5a4e21a67fdd4f2d75ab779feb83bfc", 'blake2s_128 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2s_128->new->addfile($fh)->hexdigest, "b5a4e21a67fdd4f2d75ab779feb83bfc", 'blake2s_128 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2s_128_file('t/data/text-CR.file'), pack("H*","b17af4ae04bd7412393fc958bd60fdb6"), 'blake2s_128 (raw/file/2)'); | |
62 | is( blake2s_128_file_hex('t/data/text-CR.file'), "b17af4ae04bd7412393fc958bd60fdb6", 'blake2s_128 (hex/file/2)'); | |
63 | is( blake2s_128_file_b64('t/data/text-CR.file'), "sXr0rgS9dBI5P8lYvWD9tg==", 'blake2s_128 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2s_128', 't/data/text-CR.file'), pack("H*","b17af4ae04bd7412393fc958bd60fdb6"), 'blake2s_128 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2s_128', 't/data/text-CR.file'), "b17af4ae04bd7412393fc958bd60fdb6", 'blake2s_128 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2s_128', 't/data/text-CR.file'), "sXr0rgS9dBI5P8lYvWD9tg==", 'blake2s_128 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2s_128', 't/data/text-CR.file'), "sXr0rgS9dBI5P8lYvWD9tg", 'blake2s_128 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2s_128->new->addfile('t/data/text-CR.file')->hexdigest, "b17af4ae04bd7412393fc958bd60fdb6", 'blake2s_128 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2s_128->new->addfile($fh)->hexdigest, "b17af4ae04bd7412393fc958bd60fdb6", 'blake2s_128 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2s_128_file('t/data/text-CRLF.file'), pack("H*","5e7c030d5e05b0c8c34105634417770c"), 'blake2s_128 (raw/file/3)'); | |
77 | is( blake2s_128_file_hex('t/data/text-CRLF.file'), "5e7c030d5e05b0c8c34105634417770c", 'blake2s_128 (hex/file/3)'); | |
78 | is( blake2s_128_file_b64('t/data/text-CRLF.file'), "XnwDDV4FsMjDQQVjRBd3DA==", 'blake2s_128 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2s_128', 't/data/text-CRLF.file'), pack("H*","5e7c030d5e05b0c8c34105634417770c"), 'blake2s_128 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2s_128', 't/data/text-CRLF.file'), "5e7c030d5e05b0c8c34105634417770c", 'blake2s_128 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2s_128', 't/data/text-CRLF.file'), "XnwDDV4FsMjDQQVjRBd3DA==", 'blake2s_128 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2s_128', 't/data/text-CRLF.file'), "XnwDDV4FsMjDQQVjRBd3DA", 'blake2s_128 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2s_128->new->addfile('t/data/text-CRLF.file')->hexdigest, "5e7c030d5e05b0c8c34105634417770c", 'blake2s_128 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2s_128->new->addfile($fh)->hexdigest, "5e7c030d5e05b0c8c34105634417770c", 'blake2s_128 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2s_128_file('t/data/text-LF.file'), pack("H*","72a2b42b4c947d3d3c479b3b0e596aae"), 'blake2s_128 (raw/file/4)'); | |
92 | is( blake2s_128_file_hex('t/data/text-LF.file'), "72a2b42b4c947d3d3c479b3b0e596aae", 'blake2s_128 (hex/file/4)'); | |
93 | is( blake2s_128_file_b64('t/data/text-LF.file'), "cqK0K0yUfT08R5s7Dllqrg==", 'blake2s_128 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2s_128', 't/data/text-LF.file'), pack("H*","72a2b42b4c947d3d3c479b3b0e596aae"), 'blake2s_128 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2s_128', 't/data/text-LF.file'), "72a2b42b4c947d3d3c479b3b0e596aae", 'blake2s_128 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2s_128', 't/data/text-LF.file'), "cqK0K0yUfT08R5s7Dllqrg==", 'blake2s_128 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2s_128', 't/data/text-LF.file'), "cqK0K0yUfT08R5s7Dllqrg", 'blake2s_128 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2s_128->new->addfile('t/data/text-LF.file')->hexdigest, "72a2b42b4c947d3d3c479b3b0e596aae", 'blake2s_128 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2s_128->new->addfile($fh)->hexdigest, "72a2b42b4c947d3d3c479b3b0e596aae", 'blake2s_128 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2s_160 qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2s_160'), 20, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2s_160'), 20, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2s_160::hashsize, 20, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2s_160->hashsize, 20, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2s_160')->hashsize, 20, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2s_160->new->hashsize, 20, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2s_160(""), pack("H*","354c9c33f735962418bdacb9479873429c34916f"), 'blake2s_160 (raw/1)'); | |
19 | is( blake2s_160_hex(""), "354c9c33f735962418bdacb9479873429c34916f", 'blake2s_160 (hex/1)'); | |
20 | is( blake2s_160_b64(""), "NUycM/c1liQYvay5R5hzQpw0kW8=", 'blake2s_160 (base64/1)'); | |
21 | is( digest_data('BLAKE2s_160', ""), pack("H*","354c9c33f735962418bdacb9479873429c34916f"), 'blake2s_160 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2s_160', ""), "354c9c33f735962418bdacb9479873429c34916f", 'blake2s_160 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2s_160', ""), "NUycM/c1liQYvay5R5hzQpw0kW8=", 'blake2s_160 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2s_160', ""), "NUycM_c1liQYvay5R5hzQpw0kW8", 'blake2s_160 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2s_160->new->add("")->hexdigest, "354c9c33f735962418bdacb9479873429c34916f", 'blake2s_160 (OO/1)'); | |
26 | ||
27 | is( blake2s_160("123"), pack("H*","0acf4489ee7548f29fc6f6d58605f8399b69d664"), 'blake2s_160 (raw/2)'); | |
28 | is( blake2s_160_hex("123"), "0acf4489ee7548f29fc6f6d58605f8399b69d664", 'blake2s_160 (hex/2)'); | |
29 | is( blake2s_160_b64("123"), "Cs9Eie51SPKfxvbVhgX4OZtp1mQ=", 'blake2s_160 (base64/2)'); | |
30 | is( digest_data('BLAKE2s_160', "123"), pack("H*","0acf4489ee7548f29fc6f6d58605f8399b69d664"), 'blake2s_160 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2s_160', "123"), "0acf4489ee7548f29fc6f6d58605f8399b69d664", 'blake2s_160 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2s_160', "123"), "Cs9Eie51SPKfxvbVhgX4OZtp1mQ=", 'blake2s_160 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2s_160', "123"), "Cs9Eie51SPKfxvbVhgX4OZtp1mQ", 'blake2s_160 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2s_160->new->add("123")->hexdigest, "0acf4489ee7548f29fc6f6d58605f8399b69d664", 'blake2s_160 (OO/2)'); | |
35 | ||
36 | is( blake2s_160("test\0test\0test\n"), pack("H*","7e496917ea2fdbb95254bfc7e161144b6a106823"), 'blake2s_160 (raw/3)'); | |
37 | is( blake2s_160_hex("test\0test\0test\n"), "7e496917ea2fdbb95254bfc7e161144b6a106823", 'blake2s_160 (hex/3)'); | |
38 | is( blake2s_160_b64("test\0test\0test\n"), "fklpF+ov27lSVL/H4WEUS2oQaCM=", 'blake2s_160 (base64/3)'); | |
39 | is( digest_data('BLAKE2s_160', "test\0test\0test\n"), pack("H*","7e496917ea2fdbb95254bfc7e161144b6a106823"), 'blake2s_160 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2s_160', "test\0test\0test\n"), "7e496917ea2fdbb95254bfc7e161144b6a106823", 'blake2s_160 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2s_160', "test\0test\0test\n"), "fklpF+ov27lSVL/H4WEUS2oQaCM=", 'blake2s_160 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2s_160', "test\0test\0test\n"), "fklpF-ov27lSVL_H4WEUS2oQaCM", 'blake2s_160 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2s_160->new->add("test\0test\0test\n")->hexdigest, "7e496917ea2fdbb95254bfc7e161144b6a106823", 'blake2s_160 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2s_160_file('t/data/binary-test.file'), pack("H*","079c2122db24abfcbb343a2fc4c579c64fb9e534"), 'blake2s_160 (raw/file/1)'); | |
47 | is( blake2s_160_file_hex('t/data/binary-test.file'), "079c2122db24abfcbb343a2fc4c579c64fb9e534", 'blake2s_160 (hex/file/1)'); | |
48 | is( blake2s_160_file_b64('t/data/binary-test.file'), "B5whItskq/y7NDovxMV5xk+55TQ=", 'blake2s_160 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2s_160', 't/data/binary-test.file'), pack("H*","079c2122db24abfcbb343a2fc4c579c64fb9e534"), 'blake2s_160 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2s_160', 't/data/binary-test.file'), "079c2122db24abfcbb343a2fc4c579c64fb9e534", 'blake2s_160 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2s_160', 't/data/binary-test.file'), "B5whItskq/y7NDovxMV5xk+55TQ=", 'blake2s_160 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2s_160', 't/data/binary-test.file'), "B5whItskq_y7NDovxMV5xk-55TQ", 'blake2s_160 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2s_160->new->addfile('t/data/binary-test.file')->hexdigest, "079c2122db24abfcbb343a2fc4c579c64fb9e534", 'blake2s_160 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2s_160->new->addfile($fh)->hexdigest, "079c2122db24abfcbb343a2fc4c579c64fb9e534", 'blake2s_160 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2s_160_file('t/data/text-CR.file'), pack("H*","99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de"), 'blake2s_160 (raw/file/2)'); | |
62 | is( blake2s_160_file_hex('t/data/text-CR.file'), "99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de", 'blake2s_160 (hex/file/2)'); | |
63 | is( blake2s_160_file_b64('t/data/text-CR.file'), "mey+MO1Gh+1tjIrL/GIFpKPOod4=", 'blake2s_160 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2s_160', 't/data/text-CR.file'), pack("H*","99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de"), 'blake2s_160 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2s_160', 't/data/text-CR.file'), "99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de", 'blake2s_160 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2s_160', 't/data/text-CR.file'), "mey+MO1Gh+1tjIrL/GIFpKPOod4=", 'blake2s_160 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2s_160', 't/data/text-CR.file'), "mey-MO1Gh-1tjIrL_GIFpKPOod4", 'blake2s_160 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2s_160->new->addfile('t/data/text-CR.file')->hexdigest, "99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de", 'blake2s_160 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2s_160->new->addfile($fh)->hexdigest, "99ecbe30ed4687ed6d8c8acbfc6205a4a3cea1de", 'blake2s_160 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2s_160_file('t/data/text-CRLF.file'), pack("H*","12fb04520b12fda25ac2845d5a7c8fb962811b0b"), 'blake2s_160 (raw/file/3)'); | |
77 | is( blake2s_160_file_hex('t/data/text-CRLF.file'), "12fb04520b12fda25ac2845d5a7c8fb962811b0b", 'blake2s_160 (hex/file/3)'); | |
78 | is( blake2s_160_file_b64('t/data/text-CRLF.file'), "EvsEUgsS/aJawoRdWnyPuWKBGws=", 'blake2s_160 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2s_160', 't/data/text-CRLF.file'), pack("H*","12fb04520b12fda25ac2845d5a7c8fb962811b0b"), 'blake2s_160 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2s_160', 't/data/text-CRLF.file'), "12fb04520b12fda25ac2845d5a7c8fb962811b0b", 'blake2s_160 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2s_160', 't/data/text-CRLF.file'), "EvsEUgsS/aJawoRdWnyPuWKBGws=", 'blake2s_160 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2s_160', 't/data/text-CRLF.file'), "EvsEUgsS_aJawoRdWnyPuWKBGws", 'blake2s_160 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2s_160->new->addfile('t/data/text-CRLF.file')->hexdigest, "12fb04520b12fda25ac2845d5a7c8fb962811b0b", 'blake2s_160 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2s_160->new->addfile($fh)->hexdigest, "12fb04520b12fda25ac2845d5a7c8fb962811b0b", 'blake2s_160 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2s_160_file('t/data/text-LF.file'), pack("H*","72f0b448af483431f552dcd4ba426209f2d0f4dc"), 'blake2s_160 (raw/file/4)'); | |
92 | is( blake2s_160_file_hex('t/data/text-LF.file'), "72f0b448af483431f552dcd4ba426209f2d0f4dc", 'blake2s_160 (hex/file/4)'); | |
93 | is( blake2s_160_file_b64('t/data/text-LF.file'), "cvC0SK9INDH1UtzUukJiCfLQ9Nw=", 'blake2s_160 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2s_160', 't/data/text-LF.file'), pack("H*","72f0b448af483431f552dcd4ba426209f2d0f4dc"), 'blake2s_160 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2s_160', 't/data/text-LF.file'), "72f0b448af483431f552dcd4ba426209f2d0f4dc", 'blake2s_160 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2s_160', 't/data/text-LF.file'), "cvC0SK9INDH1UtzUukJiCfLQ9Nw=", 'blake2s_160 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2s_160', 't/data/text-LF.file'), "cvC0SK9INDH1UtzUukJiCfLQ9Nw", 'blake2s_160 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2s_160->new->addfile('t/data/text-LF.file')->hexdigest, "72f0b448af483431f552dcd4ba426209f2d0f4dc", 'blake2s_160 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2s_160->new->addfile($fh)->hexdigest, "72f0b448af483431f552dcd4ba426209f2d0f4dc", 'blake2s_160 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2s_224 qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2s_224'), 28, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2s_224'), 28, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2s_224::hashsize, 28, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2s_224->hashsize, 28, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2s_224')->hashsize, 28, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2s_224->new->hashsize, 28, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2s_224(""), pack("H*","1fa1291e65248b37b3433475b2a0dd63d54a11ecc4e3e034e7bc1ef4"), 'blake2s_224 (raw/1)'); | |
19 | is( blake2s_224_hex(""), "1fa1291e65248b37b3433475b2a0dd63d54a11ecc4e3e034e7bc1ef4", 'blake2s_224 (hex/1)'); | |
20 | is( blake2s_224_b64(""), "H6EpHmUkizezQzR1sqDdY9VKEezE4+A057we9A==", 'blake2s_224 (base64/1)'); | |
21 | is( digest_data('BLAKE2s_224', ""), pack("H*","1fa1291e65248b37b3433475b2a0dd63d54a11ecc4e3e034e7bc1ef4"), 'blake2s_224 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2s_224', ""), "1fa1291e65248b37b3433475b2a0dd63d54a11ecc4e3e034e7bc1ef4", 'blake2s_224 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2s_224', ""), "H6EpHmUkizezQzR1sqDdY9VKEezE4+A057we9A==", 'blake2s_224 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2s_224', ""), "H6EpHmUkizezQzR1sqDdY9VKEezE4-A057we9A", 'blake2s_224 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2s_224->new->add("")->hexdigest, "1fa1291e65248b37b3433475b2a0dd63d54a11ecc4e3e034e7bc1ef4", 'blake2s_224 (OO/1)'); | |
26 | ||
27 | is( blake2s_224("123"), pack("H*","8b49aa9362d8236d18b52acbcb3a62fa07d2eb9cf007a48d044d94f1"), 'blake2s_224 (raw/2)'); | |
28 | is( blake2s_224_hex("123"), "8b49aa9362d8236d18b52acbcb3a62fa07d2eb9cf007a48d044d94f1", 'blake2s_224 (hex/2)'); | |
29 | is( blake2s_224_b64("123"), "i0mqk2LYI20YtSrLyzpi+gfS65zwB6SNBE2U8Q==", 'blake2s_224 (base64/2)'); | |
30 | is( digest_data('BLAKE2s_224', "123"), pack("H*","8b49aa9362d8236d18b52acbcb3a62fa07d2eb9cf007a48d044d94f1"), 'blake2s_224 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2s_224', "123"), "8b49aa9362d8236d18b52acbcb3a62fa07d2eb9cf007a48d044d94f1", 'blake2s_224 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2s_224', "123"), "i0mqk2LYI20YtSrLyzpi+gfS65zwB6SNBE2U8Q==", 'blake2s_224 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2s_224', "123"), "i0mqk2LYI20YtSrLyzpi-gfS65zwB6SNBE2U8Q", 'blake2s_224 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2s_224->new->add("123")->hexdigest, "8b49aa9362d8236d18b52acbcb3a62fa07d2eb9cf007a48d044d94f1", 'blake2s_224 (OO/2)'); | |
35 | ||
36 | is( blake2s_224("test\0test\0test\n"), pack("H*","fdb36715bc01dc9575ad662a25add0601e8c73fb8b92fd35190c9f6b"), 'blake2s_224 (raw/3)'); | |
37 | is( blake2s_224_hex("test\0test\0test\n"), "fdb36715bc01dc9575ad662a25add0601e8c73fb8b92fd35190c9f6b", 'blake2s_224 (hex/3)'); | |
38 | is( blake2s_224_b64("test\0test\0test\n"), "/bNnFbwB3JV1rWYqJa3QYB6Mc/uLkv01GQyfaw==", 'blake2s_224 (base64/3)'); | |
39 | is( digest_data('BLAKE2s_224', "test\0test\0test\n"), pack("H*","fdb36715bc01dc9575ad662a25add0601e8c73fb8b92fd35190c9f6b"), 'blake2s_224 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2s_224', "test\0test\0test\n"), "fdb36715bc01dc9575ad662a25add0601e8c73fb8b92fd35190c9f6b", 'blake2s_224 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2s_224', "test\0test\0test\n"), "/bNnFbwB3JV1rWYqJa3QYB6Mc/uLkv01GQyfaw==", 'blake2s_224 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2s_224', "test\0test\0test\n"), "_bNnFbwB3JV1rWYqJa3QYB6Mc_uLkv01GQyfaw", 'blake2s_224 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2s_224->new->add("test\0test\0test\n")->hexdigest, "fdb36715bc01dc9575ad662a25add0601e8c73fb8b92fd35190c9f6b", 'blake2s_224 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2s_224_file('t/data/binary-test.file'), pack("H*","1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04"), 'blake2s_224 (raw/file/1)'); | |
47 | is( blake2s_224_file_hex('t/data/binary-test.file'), "1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04", 'blake2s_224 (hex/file/1)'); | |
48 | is( blake2s_224_file_b64('t/data/binary-test.file'), "EITnlqP0THwGw8ieA3AcXJUib5KwFTigWgXrBA==", 'blake2s_224 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2s_224', 't/data/binary-test.file'), pack("H*","1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04"), 'blake2s_224 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2s_224', 't/data/binary-test.file'), "1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04", 'blake2s_224 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2s_224', 't/data/binary-test.file'), "EITnlqP0THwGw8ieA3AcXJUib5KwFTigWgXrBA==", 'blake2s_224 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2s_224', 't/data/binary-test.file'), "EITnlqP0THwGw8ieA3AcXJUib5KwFTigWgXrBA", 'blake2s_224 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2s_224->new->addfile('t/data/binary-test.file')->hexdigest, "1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04", 'blake2s_224 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2s_224->new->addfile($fh)->hexdigest, "1084e796a3f44c7c06c3c89e03701c5c95226f92b01538a05a05eb04", 'blake2s_224 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2s_224_file('t/data/text-CR.file'), pack("H*","d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c"), 'blake2s_224 (raw/file/2)'); | |
62 | is( blake2s_224_file_hex('t/data/text-CR.file'), "d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c", 'blake2s_224 (hex/file/2)'); | |
63 | is( blake2s_224_file_b64('t/data/text-CR.file'), "0VlgI8wzMETverheZoakNvANECTDzqmA6f1ALA==", 'blake2s_224 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2s_224', 't/data/text-CR.file'), pack("H*","d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c"), 'blake2s_224 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2s_224', 't/data/text-CR.file'), "d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c", 'blake2s_224 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2s_224', 't/data/text-CR.file'), "0VlgI8wzMETverheZoakNvANECTDzqmA6f1ALA==", 'blake2s_224 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2s_224', 't/data/text-CR.file'), "0VlgI8wzMETverheZoakNvANECTDzqmA6f1ALA", 'blake2s_224 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2s_224->new->addfile('t/data/text-CR.file')->hexdigest, "d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c", 'blake2s_224 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2s_224->new->addfile($fh)->hexdigest, "d1596023cc333044ef7ab85e6686a436f00d1024c3cea980e9fd402c", 'blake2s_224 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2s_224_file('t/data/text-CRLF.file'), pack("H*","c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796"), 'blake2s_224 (raw/file/3)'); | |
77 | is( blake2s_224_file_hex('t/data/text-CRLF.file'), "c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796", 'blake2s_224 (hex/file/3)'); | |
78 | is( blake2s_224_file_b64('t/data/text-CRLF.file'), "womECfo+o7jihZuUT4nPtCRM7SBjhy6+vVNnlg==", 'blake2s_224 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2s_224', 't/data/text-CRLF.file'), pack("H*","c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796"), 'blake2s_224 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2s_224', 't/data/text-CRLF.file'), "c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796", 'blake2s_224 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2s_224', 't/data/text-CRLF.file'), "womECfo+o7jihZuUT4nPtCRM7SBjhy6+vVNnlg==", 'blake2s_224 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2s_224', 't/data/text-CRLF.file'), "womECfo-o7jihZuUT4nPtCRM7SBjhy6-vVNnlg", 'blake2s_224 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2s_224->new->addfile('t/data/text-CRLF.file')->hexdigest, "c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796", 'blake2s_224 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2s_224->new->addfile($fh)->hexdigest, "c2898409fa3ea3b8e2859b944f89cfb4244ced2063872ebebd536796", 'blake2s_224 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2s_224_file('t/data/text-LF.file'), pack("H*","d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89"), 'blake2s_224 (raw/file/4)'); | |
92 | is( blake2s_224_file_hex('t/data/text-LF.file'), "d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89", 'blake2s_224 (hex/file/4)'); | |
93 | is( blake2s_224_file_b64('t/data/text-LF.file'), "2Po25u0megf4cdcfUPnbxIZhJgpeahzejIAriQ==", 'blake2s_224 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2s_224', 't/data/text-LF.file'), pack("H*","d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89"), 'blake2s_224 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2s_224', 't/data/text-LF.file'), "d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89", 'blake2s_224 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2s_224', 't/data/text-LF.file'), "2Po25u0megf4cdcfUPnbxIZhJgpeahzejIAriQ==", 'blake2s_224 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2s_224', 't/data/text-LF.file'), "2Po25u0megf4cdcfUPnbxIZhJgpeahzejIAriQ", 'blake2s_224 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2s_224->new->addfile('t/data/text-LF.file')->hexdigest, "d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89", 'blake2s_224 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2s_224->new->addfile($fh)->hexdigest, "d8fa36e6ed267a07f871d71f50f9dbc48661260a5e6a1cde8c802b89", 'blake2s_224 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
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 + 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::BLAKE2s_256 qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u ); | |
9 | ||
10 | is( Crypt::Digest::hashsize('BLAKE2s_256'), 32, 'hashsize/1'); | |
11 | is( Crypt::Digest->hashsize('BLAKE2s_256'), 32, 'hashsize/2'); | |
12 | is( Crypt::Digest::BLAKE2s_256::hashsize, 32, 'hashsize/3'); | |
13 | is( Crypt::Digest::BLAKE2s_256->hashsize, 32, 'hashsize/4'); | |
14 | is( Crypt::Digest->new('BLAKE2s_256')->hashsize, 32, 'hashsize/5'); | |
15 | is( Crypt::Digest::BLAKE2s_256->new->hashsize, 32, 'hashsize/6'); | |
16 | ||
17 | ||
18 | is( blake2s_256(""), pack("H*","69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9"), 'blake2s_256 (raw/1)'); | |
19 | is( blake2s_256_hex(""), "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9", 'blake2s_256 (hex/1)'); | |
20 | is( blake2s_256_b64(""), "aSF6MHmQgJThESHQQjVKfB9VtkgsoaUeGyUN/R7Q7vk=", 'blake2s_256 (base64/1)'); | |
21 | is( digest_data('BLAKE2s_256', ""), pack("H*","69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9"), 'blake2s_256 (digest_data_raw/1)'); | |
22 | is( digest_data_hex('BLAKE2s_256', ""), "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9", 'blake2s_256 (digest_data_hex/1)'); | |
23 | is( digest_data_b64('BLAKE2s_256', ""), "aSF6MHmQgJThESHQQjVKfB9VtkgsoaUeGyUN/R7Q7vk=", 'blake2s_256 (digest_data_b64/1)'); | |
24 | is( digest_data_b64u('BLAKE2s_256', ""), "aSF6MHmQgJThESHQQjVKfB9VtkgsoaUeGyUN_R7Q7vk", 'blake2s_256 (digest_data_b64u/1)'); | |
25 | is( Crypt::Digest::BLAKE2s_256->new->add("")->hexdigest, "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9", 'blake2s_256 (OO/1)'); | |
26 | ||
27 | is( blake2s_256("123"), pack("H*","e906644ad861b58d47500e6c636ee3bf4cb4bb00016bb352b1d2d03d122c1605"), 'blake2s_256 (raw/2)'); | |
28 | is( blake2s_256_hex("123"), "e906644ad861b58d47500e6c636ee3bf4cb4bb00016bb352b1d2d03d122c1605", 'blake2s_256 (hex/2)'); | |
29 | is( blake2s_256_b64("123"), "6QZkSthhtY1HUA5sY27jv0y0uwABa7NSsdLQPRIsFgU=", 'blake2s_256 (base64/2)'); | |
30 | is( digest_data('BLAKE2s_256', "123"), pack("H*","e906644ad861b58d47500e6c636ee3bf4cb4bb00016bb352b1d2d03d122c1605"), 'blake2s_256 (digest_data_raw/2)'); | |
31 | is( digest_data_hex('BLAKE2s_256', "123"), "e906644ad861b58d47500e6c636ee3bf4cb4bb00016bb352b1d2d03d122c1605", 'blake2s_256 (digest_data_hex/2)'); | |
32 | is( digest_data_b64('BLAKE2s_256', "123"), "6QZkSthhtY1HUA5sY27jv0y0uwABa7NSsdLQPRIsFgU=", 'blake2s_256 (digest_data_b64/2)'); | |
33 | is( digest_data_b64u('BLAKE2s_256', "123"), "6QZkSthhtY1HUA5sY27jv0y0uwABa7NSsdLQPRIsFgU", 'blake2s_256 (digest_data_b64u/2)'); | |
34 | is( Crypt::Digest::BLAKE2s_256->new->add("123")->hexdigest, "e906644ad861b58d47500e6c636ee3bf4cb4bb00016bb352b1d2d03d122c1605", 'blake2s_256 (OO/2)'); | |
35 | ||
36 | is( blake2s_256("test\0test\0test\n"), pack("H*","01f3bf97dce139caa74eb5cb02d2f01e4afac0c49ebf655db3168d1ca7e1442b"), 'blake2s_256 (raw/3)'); | |
37 | is( blake2s_256_hex("test\0test\0test\n"), "01f3bf97dce139caa74eb5cb02d2f01e4afac0c49ebf655db3168d1ca7e1442b", 'blake2s_256 (hex/3)'); | |
38 | is( blake2s_256_b64("test\0test\0test\n"), "AfO/l9zhOcqnTrXLAtLwHkr6wMSev2VdsxaNHKfhRCs=", 'blake2s_256 (base64/3)'); | |
39 | is( digest_data('BLAKE2s_256', "test\0test\0test\n"), pack("H*","01f3bf97dce139caa74eb5cb02d2f01e4afac0c49ebf655db3168d1ca7e1442b"), 'blake2s_256 (digest_data_raw/3)'); | |
40 | is( digest_data_hex('BLAKE2s_256', "test\0test\0test\n"), "01f3bf97dce139caa74eb5cb02d2f01e4afac0c49ebf655db3168d1ca7e1442b", 'blake2s_256 (digest_data_hex/3)'); | |
41 | is( digest_data_b64('BLAKE2s_256', "test\0test\0test\n"), "AfO/l9zhOcqnTrXLAtLwHkr6wMSev2VdsxaNHKfhRCs=", 'blake2s_256 (digest_data_b64/3)'); | |
42 | is( digest_data_b64u('BLAKE2s_256', "test\0test\0test\n"), "AfO_l9zhOcqnTrXLAtLwHkr6wMSev2VdsxaNHKfhRCs", 'blake2s_256 (digest_data_b64u/3)'); | |
43 | is( Crypt::Digest::BLAKE2s_256->new->add("test\0test\0test\n")->hexdigest, "01f3bf97dce139caa74eb5cb02d2f01e4afac0c49ebf655db3168d1ca7e1442b", 'blake2s_256 (OO/3)'); | |
44 | ||
45 | ||
46 | is( blake2s_256_file('t/data/binary-test.file'), pack("H*","af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad"), 'blake2s_256 (raw/file/1)'); | |
47 | is( blake2s_256_file_hex('t/data/binary-test.file'), "af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad", 'blake2s_256 (hex/file/1)'); | |
48 | is( blake2s_256_file_b64('t/data/binary-test.file'), "r24/HPK/vkvjkRQmCfsW48OvSUoIUpJwMqcNWH9oZa0=", 'blake2s_256 (base64/file/1)'); | |
49 | is( digest_file('BLAKE2s_256', 't/data/binary-test.file'), pack("H*","af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad"), 'blake2s_256 (digest_file_raw/file/1)'); | |
50 | is( digest_file_hex('BLAKE2s_256', 't/data/binary-test.file'), "af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad", 'blake2s_256 (digest_file_hex/file/1)'); | |
51 | is( digest_file_b64('BLAKE2s_256', 't/data/binary-test.file'), "r24/HPK/vkvjkRQmCfsW48OvSUoIUpJwMqcNWH9oZa0=", 'blake2s_256 (digest_file_b64/file/1)'); | |
52 | is( digest_file_b64u('BLAKE2s_256', 't/data/binary-test.file'), "r24_HPK_vkvjkRQmCfsW48OvSUoIUpJwMqcNWH9oZa0", 'blake2s_256 (digest_file_b64u/file/1)'); | |
53 | is( Crypt::Digest::BLAKE2s_256->new->addfile('t/data/binary-test.file')->hexdigest, "af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad", 'blake2s_256 (OO/file/1)'); | |
54 | { | |
55 | open(my $fh, '<', 't/data/binary-test.file'); | |
56 | binmode($fh); | |
57 | is( Crypt::Digest::BLAKE2s_256->new->addfile($fh)->hexdigest, "af6e3f1cf2bfbe4be391142609fb16e3c3af494a0852927032a70d587f6865ad", 'blake2s_256 (OO/filehandle/1)'); | |
58 | close($fh); | |
59 | } | |
60 | ||
61 | is( blake2s_256_file('t/data/text-CR.file'), pack("H*","4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449"), 'blake2s_256 (raw/file/2)'); | |
62 | is( blake2s_256_file_hex('t/data/text-CR.file'), "4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449", 'blake2s_256 (hex/file/2)'); | |
63 | is( blake2s_256_file_b64('t/data/text-CR.file'), "QpfdsmNx8xu/sLT7vkesjIQ775KF9yqRg8/9vZrcBEk=", 'blake2s_256 (base64/file/2)'); | |
64 | is( digest_file('BLAKE2s_256', 't/data/text-CR.file'), pack("H*","4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449"), 'blake2s_256 (digest_file_raw/file/2)'); | |
65 | is( digest_file_hex('BLAKE2s_256', 't/data/text-CR.file'), "4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449", 'blake2s_256 (digest_file_hex/file/2)'); | |
66 | is( digest_file_b64('BLAKE2s_256', 't/data/text-CR.file'), "QpfdsmNx8xu/sLT7vkesjIQ775KF9yqRg8/9vZrcBEk=", 'blake2s_256 (digest_file_b64/file/2)'); | |
67 | is( digest_file_b64u('BLAKE2s_256', 't/data/text-CR.file'), "QpfdsmNx8xu_sLT7vkesjIQ775KF9yqRg8_9vZrcBEk", 'blake2s_256 (digest_file_b64u/file/2)'); | |
68 | is( Crypt::Digest::BLAKE2s_256->new->addfile('t/data/text-CR.file')->hexdigest, "4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449", 'blake2s_256 (OO/file/2)'); | |
69 | { | |
70 | open(my $fh, '<', 't/data/text-CR.file'); | |
71 | binmode($fh); | |
72 | is( Crypt::Digest::BLAKE2s_256->new->addfile($fh)->hexdigest, "4297ddb26371f31bbfb0b4fbbe47ac8c843bef9285f72a9183cffdbd9adc0449", 'blake2s_256 (OO/filehandle/2)'); | |
73 | close($fh); | |
74 | } | |
75 | ||
76 | is( blake2s_256_file('t/data/text-CRLF.file'), pack("H*","ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267"), 'blake2s_256 (raw/file/3)'); | |
77 | is( blake2s_256_file_hex('t/data/text-CRLF.file'), "ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267", 'blake2s_256 (hex/file/3)'); | |
78 | is( blake2s_256_file_b64('t/data/text-CRLF.file'), "rp1wMBufD85jRjocO93GQ4yTQrE+ZwFSMjrVAmeE4mc=", 'blake2s_256 (base64/file/3)'); | |
79 | is( digest_file('BLAKE2s_256', 't/data/text-CRLF.file'), pack("H*","ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267"), 'blake2s_256 (digest_file_raw/file/3)'); | |
80 | is( digest_file_hex('BLAKE2s_256', 't/data/text-CRLF.file'), "ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267", 'blake2s_256 (digest_file_hex/file/3)'); | |
81 | is( digest_file_b64('BLAKE2s_256', 't/data/text-CRLF.file'), "rp1wMBufD85jRjocO93GQ4yTQrE+ZwFSMjrVAmeE4mc=", 'blake2s_256 (digest_file_b64/file/3)'); | |
82 | is( digest_file_b64u('BLAKE2s_256', 't/data/text-CRLF.file'), "rp1wMBufD85jRjocO93GQ4yTQrE-ZwFSMjrVAmeE4mc", 'blake2s_256 (digest_file_b64u/file/3)'); | |
83 | is( Crypt::Digest::BLAKE2s_256->new->addfile('t/data/text-CRLF.file')->hexdigest, "ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267", 'blake2s_256 (OO/file/3)'); | |
84 | { | |
85 | open(my $fh, '<', 't/data/text-CRLF.file'); | |
86 | binmode($fh); | |
87 | is( Crypt::Digest::BLAKE2s_256->new->addfile($fh)->hexdigest, "ae9d70301b9f0fce63463a1c3bddc6438c9342b13e670152323ad5026784e267", 'blake2s_256 (OO/filehandle/3)'); | |
88 | close($fh); | |
89 | } | |
90 | ||
91 | is( blake2s_256_file('t/data/text-LF.file'), pack("H*","34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8"), 'blake2s_256 (raw/file/4)'); | |
92 | is( blake2s_256_file_hex('t/data/text-LF.file'), "34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8", 'blake2s_256 (hex/file/4)'); | |
93 | is( blake2s_256_file_b64('t/data/text-LF.file'), "NMnbgUlOiIZhvalWnYysnSqRBKfvfkZKq85wHo2Qk9g=", 'blake2s_256 (base64/file/4)'); | |
94 | is( digest_file('BLAKE2s_256', 't/data/text-LF.file'), pack("H*","34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8"), 'blake2s_256 (digest_file_raw/file/4)'); | |
95 | is( digest_file_hex('BLAKE2s_256', 't/data/text-LF.file'), "34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8", 'blake2s_256 (digest_file_hex/file/4)'); | |
96 | is( digest_file_b64('BLAKE2s_256', 't/data/text-LF.file'), "NMnbgUlOiIZhvalWnYysnSqRBKfvfkZKq85wHo2Qk9g=", 'blake2s_256 (digest_file_b64/file/4)'); | |
97 | is( digest_file_b64u('BLAKE2s_256', 't/data/text-LF.file'), "NMnbgUlOiIZhvalWnYysnSqRBKfvfkZKq85wHo2Qk9g", 'blake2s_256 (digest_file_b64u/file/4)'); | |
98 | is( Crypt::Digest::BLAKE2s_256->new->addfile('t/data/text-LF.file')->hexdigest, "34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8", 'blake2s_256 (OO/file/4)'); | |
99 | { | |
100 | open(my $fh, '<', 't/data/text-LF.file'); | |
101 | binmode($fh); | |
102 | is( Crypt::Digest::BLAKE2s_256->new->addfile($fh)->hexdigest, "34c9db81494e888661bda9569d8cac9d2a9104a7ef7e464aabce701e8d9093d8", 'blake2s_256 (OO/filehandle/4)'); | |
103 | close($fh); | |
104 | } |
0 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 36; | |
6 | ||
7 | use Crypt::Mac::BLAKE2b qw( blake2b blake2b_hex blake2b_b64 blake2b_b64u ); | |
8 | ||
9 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add("")->mac), '171e61c46e5eb96bfe44b8167f72112fa3dacff54ff9b938c92a988b7b65a550', 'BLAKE2b/oo+raw/1'); | |
10 | is( Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add("")->hexmac, '171e61c46e5eb96bfe44b8167f72112fa3dacff54ff9b938c92a988b7b65a550', 'BLAKE2b/oo+hex/1'); | |
11 | is( unpack('H*', blake2b(32,'12345678901234561234567890123456',"")), '171e61c46e5eb96bfe44b8167f72112fa3dacff54ff9b938c92a988b7b65a550', 'BLAKE2b/func+raw/1'); | |
12 | is( blake2b_hex(32,'12345678901234561234567890123456',""), '171e61c46e5eb96bfe44b8167f72112fa3dacff54ff9b938c92a988b7b65a550', 'BLAKE2b/func+hex/1'); | |
13 | is( blake2b_b64(32,'12345678901234561234567890123456',""), 'Fx5hxG5euWv+RLgWf3IRL6Paz/VP+bk4ySqYi3tlpVA=', 'BLAKE2b/func+b64/1'); | |
14 | is( blake2b_b64u(32,'12345678901234561234567890123456',""), 'Fx5hxG5euWv-RLgWf3IRL6Paz_VP-bk4ySqYi3tlpVA', 'BLAKE2b/func+b64u/1'); | |
15 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("")->mac), 'a9c114765666cf3e313253110efcc3b844739fe14bf1b32bf69316c6716978f0', 'BLAKE2b/oo+raw/2'); | |
16 | is( Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("")->hexmac, 'a9c114765666cf3e313253110efcc3b844739fe14bf1b32bf69316c6716978f0', 'BLAKE2b/oo+hex/2'); | |
17 | is( unpack('H*', blake2b(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"")), 'a9c114765666cf3e313253110efcc3b844739fe14bf1b32bf69316c6716978f0', 'BLAKE2b/func+raw/2'); | |
18 | is( blake2b_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), 'a9c114765666cf3e313253110efcc3b844739fe14bf1b32bf69316c6716978f0', 'BLAKE2b/func+hex/2'); | |
19 | is( blake2b_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), 'qcEUdlZmzz4xMlMRDvzDuERzn+FL8bMr9pMWxnFpePA=', 'BLAKE2b/func+b64/2'); | |
20 | is( blake2b_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), 'qcEUdlZmzz4xMlMRDvzDuERzn-FL8bMr9pMWxnFpePA', 'BLAKE2b/func+b64u/2'); | |
21 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add(123)->mac), '17391b8e492e7994b958bcbf7ab2c4fe807749e8c5401d84b8dff226e0d56369', 'BLAKE2b/oo+raw/3'); | |
22 | is( Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add(123)->hexmac, '17391b8e492e7994b958bcbf7ab2c4fe807749e8c5401d84b8dff226e0d56369', 'BLAKE2b/oo+hex/3'); | |
23 | is( unpack('H*', blake2b(32,'12345678901234561234567890123456',123)), '17391b8e492e7994b958bcbf7ab2c4fe807749e8c5401d84b8dff226e0d56369', 'BLAKE2b/func+raw/3'); | |
24 | is( blake2b_hex(32,'12345678901234561234567890123456',123), '17391b8e492e7994b958bcbf7ab2c4fe807749e8c5401d84b8dff226e0d56369', 'BLAKE2b/func+hex/3'); | |
25 | is( blake2b_b64(32,'12345678901234561234567890123456',123), 'FzkbjkkueZS5WLy/erLE/oB3SejFQB2EuN/yJuDVY2k=', 'BLAKE2b/func+b64/3'); | |
26 | is( blake2b_b64u(32,'12345678901234561234567890123456',123), 'FzkbjkkueZS5WLy_erLE_oB3SejFQB2EuN_yJuDVY2k', 'BLAKE2b/func+b64u/3'); | |
27 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add(123)->mac), '3a246b8de4f0957420dea4fbeb84f3e8f60bc79f04c08f98610008a1e814e963', 'BLAKE2b/oo+raw/4'); | |
28 | is( Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add(123)->hexmac, '3a246b8de4f0957420dea4fbeb84f3e8f60bc79f04c08f98610008a1e814e963', 'BLAKE2b/oo+hex/4'); | |
29 | is( unpack('H*', blake2b(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123)), '3a246b8de4f0957420dea4fbeb84f3e8f60bc79f04c08f98610008a1e814e963', 'BLAKE2b/func+raw/4'); | |
30 | is( blake2b_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), '3a246b8de4f0957420dea4fbeb84f3e8f60bc79f04c08f98610008a1e814e963', 'BLAKE2b/func+hex/4'); | |
31 | is( blake2b_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), 'OiRrjeTwlXQg3qT764Tz6PYLx58EwI+YYQAIoegU6WM=', 'BLAKE2b/func+b64/4'); | |
32 | is( blake2b_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), 'OiRrjeTwlXQg3qT764Tz6PYLx58EwI-YYQAIoegU6WM', 'BLAKE2b/func+b64u/4'); | |
33 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add("test\0test\0test\n")->mac), 'd24786aeea8e412a8a8ad4609c5b2244f01af0d40da2f4ae27f21171cf9bf77d', 'BLAKE2b/oo+raw/5'); | |
34 | is( Crypt::Mac::BLAKE2b->new(32,'12345678901234561234567890123456')->add("test\0test\0test\n")->hexmac, 'd24786aeea8e412a8a8ad4609c5b2244f01af0d40da2f4ae27f21171cf9bf77d', 'BLAKE2b/oo+hex/5'); | |
35 | is( unpack('H*', blake2b(32,'12345678901234561234567890123456',"test\0test\0test\n")), 'd24786aeea8e412a8a8ad4609c5b2244f01af0d40da2f4ae27f21171cf9bf77d', 'BLAKE2b/func+raw/5'); | |
36 | is( blake2b_hex(32,'12345678901234561234567890123456',"test\0test\0test\n"), 'd24786aeea8e412a8a8ad4609c5b2244f01af0d40da2f4ae27f21171cf9bf77d', 'BLAKE2b/func+hex/5'); | |
37 | is( blake2b_b64(32,'12345678901234561234567890123456',"test\0test\0test\n"), '0keGruqOQSqKitRgnFsiRPAa8NQNovSuJ/IRcc+b930=', 'BLAKE2b/func+b64/5'); | |
38 | is( blake2b_b64u(32,'12345678901234561234567890123456',"test\0test\0test\n"), '0keGruqOQSqKitRgnFsiRPAa8NQNovSuJ_IRcc-b930', 'BLAKE2b/func+b64u/5'); | |
39 | is( unpack('H*', Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("test\0test\0test\n")->mac), 'dc29010f123a4cd59c91da5fc494375962502ca2179021ebca2f6dd41befa8d2', 'BLAKE2b/oo+raw/6'); | |
40 | is( Crypt::Mac::BLAKE2b->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("test\0test\0test\n")->hexmac, 'dc29010f123a4cd59c91da5fc494375962502ca2179021ebca2f6dd41befa8d2', 'BLAKE2b/oo+hex/6'); | |
41 | is( unpack('H*', blake2b(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n")), 'dc29010f123a4cd59c91da5fc494375962502ca2179021ebca2f6dd41befa8d2', 'BLAKE2b/func+raw/6'); | |
42 | is( blake2b_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), 'dc29010f123a4cd59c91da5fc494375962502ca2179021ebca2f6dd41befa8d2', 'BLAKE2b/func+hex/6'); | |
43 | is( blake2b_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), '3CkBDxI6TNWckdpfxJQ3WWJQLKIXkCHryi9t1BvvqNI=', 'BLAKE2b/func+b64/6'); | |
44 | is( blake2b_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), '3CkBDxI6TNWckdpfxJQ3WWJQLKIXkCHryi9t1BvvqNI', 'BLAKE2b/func+b64u/6'); |
0 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 36; | |
6 | ||
7 | use Crypt::Mac::BLAKE2s qw( blake2s blake2s_hex blake2s_b64 blake2s_b64u ); | |
8 | ||
9 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add("")->mac), '6a0915e97a27e1119f10c6991e8c6218fbaaab516a099399fda92803ea24aed8', 'BLAKE2s/oo+raw/1'); | |
10 | is( Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add("")->hexmac, '6a0915e97a27e1119f10c6991e8c6218fbaaab516a099399fda92803ea24aed8', 'BLAKE2s/oo+hex/1'); | |
11 | is( unpack('H*', blake2s(32,'12345678901234561234567890123456',"")), '6a0915e97a27e1119f10c6991e8c6218fbaaab516a099399fda92803ea24aed8', 'BLAKE2s/func+raw/1'); | |
12 | is( blake2s_hex(32,'12345678901234561234567890123456',""), '6a0915e97a27e1119f10c6991e8c6218fbaaab516a099399fda92803ea24aed8', 'BLAKE2s/func+hex/1'); | |
13 | is( blake2s_b64(32,'12345678901234561234567890123456',""), 'agkV6Xon4RGfEMaZHoxiGPuqq1FqCZOZ/akoA+okrtg=', 'BLAKE2s/func+b64/1'); | |
14 | is( blake2s_b64u(32,'12345678901234561234567890123456',""), 'agkV6Xon4RGfEMaZHoxiGPuqq1FqCZOZ_akoA-okrtg', 'BLAKE2s/func+b64u/1'); | |
15 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("")->mac), '18e3ce19987ba50b30dd144c16f22655eba31409d66210bc38bbc14b5dab0519', 'BLAKE2s/oo+raw/2'); | |
16 | is( Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("")->hexmac, '18e3ce19987ba50b30dd144c16f22655eba31409d66210bc38bbc14b5dab0519', 'BLAKE2s/oo+hex/2'); | |
17 | is( unpack('H*', blake2s(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"")), '18e3ce19987ba50b30dd144c16f22655eba31409d66210bc38bbc14b5dab0519', 'BLAKE2s/func+raw/2'); | |
18 | is( blake2s_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), '18e3ce19987ba50b30dd144c16f22655eba31409d66210bc38bbc14b5dab0519', 'BLAKE2s/func+hex/2'); | |
19 | is( blake2s_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), 'GOPOGZh7pQsw3RRMFvImVeujFAnWYhC8OLvBS12rBRk=', 'BLAKE2s/func+b64/2'); | |
20 | is( blake2s_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',""), 'GOPOGZh7pQsw3RRMFvImVeujFAnWYhC8OLvBS12rBRk', 'BLAKE2s/func+b64u/2'); | |
21 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add(123)->mac), '5612150160e1943e36f569d635a452eca1d745f959ca9c8dae004e8c69c66ff4', 'BLAKE2s/oo+raw/3'); | |
22 | is( Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add(123)->hexmac, '5612150160e1943e36f569d635a452eca1d745f959ca9c8dae004e8c69c66ff4', 'BLAKE2s/oo+hex/3'); | |
23 | is( unpack('H*', blake2s(32,'12345678901234561234567890123456',123)), '5612150160e1943e36f569d635a452eca1d745f959ca9c8dae004e8c69c66ff4', 'BLAKE2s/func+raw/3'); | |
24 | is( blake2s_hex(32,'12345678901234561234567890123456',123), '5612150160e1943e36f569d635a452eca1d745f959ca9c8dae004e8c69c66ff4', 'BLAKE2s/func+hex/3'); | |
25 | is( blake2s_b64(32,'12345678901234561234567890123456',123), 'VhIVAWDhlD429WnWNaRS7KHXRflZypyNrgBOjGnGb/Q=', 'BLAKE2s/func+b64/3'); | |
26 | is( blake2s_b64u(32,'12345678901234561234567890123456',123), 'VhIVAWDhlD429WnWNaRS7KHXRflZypyNrgBOjGnGb_Q', 'BLAKE2s/func+b64u/3'); | |
27 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add(123)->mac), 'a76d7d9b3388d0e4f878634d7912ee9646f9f90089c44ee7fa70c6dc55321881', 'BLAKE2s/oo+raw/4'); | |
28 | is( Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add(123)->hexmac, 'a76d7d9b3388d0e4f878634d7912ee9646f9f90089c44ee7fa70c6dc55321881', 'BLAKE2s/oo+hex/4'); | |
29 | is( unpack('H*', blake2s(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123)), 'a76d7d9b3388d0e4f878634d7912ee9646f9f90089c44ee7fa70c6dc55321881', 'BLAKE2s/func+raw/4'); | |
30 | is( blake2s_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), 'a76d7d9b3388d0e4f878634d7912ee9646f9f90089c44ee7fa70c6dc55321881', 'BLAKE2s/func+hex/4'); | |
31 | is( blake2s_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), 'p219mzOI0OT4eGNNeRLulkb5+QCJxE7n+nDG3FUyGIE=', 'BLAKE2s/func+b64/4'); | |
32 | is( blake2s_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',123), 'p219mzOI0OT4eGNNeRLulkb5-QCJxE7n-nDG3FUyGIE', 'BLAKE2s/func+b64u/4'); | |
33 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add("test\0test\0test\n")->mac), 'ad7aab35edfaab1bdd4cf1f4fea1a7a5002b7f19892b8431961aea301c57ed8b', 'BLAKE2s/oo+raw/5'); | |
34 | is( Crypt::Mac::BLAKE2s->new(32,'12345678901234561234567890123456')->add("test\0test\0test\n")->hexmac, 'ad7aab35edfaab1bdd4cf1f4fea1a7a5002b7f19892b8431961aea301c57ed8b', 'BLAKE2s/oo+hex/5'); | |
35 | is( unpack('H*', blake2s(32,'12345678901234561234567890123456',"test\0test\0test\n")), 'ad7aab35edfaab1bdd4cf1f4fea1a7a5002b7f19892b8431961aea301c57ed8b', 'BLAKE2s/func+raw/5'); | |
36 | is( blake2s_hex(32,'12345678901234561234567890123456',"test\0test\0test\n"), 'ad7aab35edfaab1bdd4cf1f4fea1a7a5002b7f19892b8431961aea301c57ed8b', 'BLAKE2s/func+hex/5'); | |
37 | is( blake2s_b64(32,'12345678901234561234567890123456',"test\0test\0test\n"), 'rXqrNe36qxvdTPH0/qGnpQArfxmJK4QxlhrqMBxX7Ys=', 'BLAKE2s/func+b64/5'); | |
38 | is( blake2s_b64u(32,'12345678901234561234567890123456',"test\0test\0test\n"), 'rXqrNe36qxvdTPH0_qGnpQArfxmJK4QxlhrqMBxX7Ys', 'BLAKE2s/func+b64u/5'); | |
39 | is( unpack('H*', Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("test\0test\0test\n")->mac), 'a31f0e2ba5e73a3aab7e14503690515662758279075d7b68512709824923e65c', 'BLAKE2s/oo+raw/6'); | |
40 | is( Crypt::Mac::BLAKE2s->new(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')->add("test\0test\0test\n")->hexmac, 'a31f0e2ba5e73a3aab7e14503690515662758279075d7b68512709824923e65c', 'BLAKE2s/oo+hex/6'); | |
41 | is( unpack('H*', blake2s(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n")), 'a31f0e2ba5e73a3aab7e14503690515662758279075d7b68512709824923e65c', 'BLAKE2s/func+raw/6'); | |
42 | is( blake2s_hex(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), 'a31f0e2ba5e73a3aab7e14503690515662758279075d7b68512709824923e65c', 'BLAKE2s/func+hex/6'); | |
43 | is( blake2s_b64(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), 'ox8OK6XnOjqrfhRQNpBRVmJ1gnkHXXtoUScJgkkj5lw=', 'BLAKE2s/func+b64/6'); | |
44 | is( blake2s_b64u(32,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',"test\0test\0test\n"), 'ox8OK6XnOjqrfhRQNpBRVmJ1gnkHXXtoUScJgkkj5lw', 'BLAKE2s/func+b64u/6'); |