Commit 01e79f7
authored
blake2: add unkeyed hashing (#612)
This introduces unkeyed hashing for blake2 as specified in [Section 2.5
of RFC 7693](https://www.rfc-editor.org/rfc/rfc7693.html#section-2.5)
states the following:
The second (little-endian) byte of the parameter block, "kk", specifies
the key size in bytes. Set kk = 00 for unkeyed hashing.
I propose to make the key an `Option<&[u8]>`:
```rust
pub fn new_with_salt_and_personal(
key: Option<&[u8]>,
salt: &[u8],
persona: &[u8],
) -> Result<Self, InvalidLength>
```
By making the key an `Option<&[u8]>` - rather than opting for the
unkeyed usage in case of an empty `key` - we make the unkeyed usage
explicit and avoid inadvertent usages.
This closes #482.
See also #509.1 parent 2795b4f commit 01e79f7
4 files changed
+70
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
289 | 291 | | |
290 | 292 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
295 | 297 | | |
296 | 298 | | |
297 | | - | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
301 | | - | |
| 303 | + | |
302 | 304 | | |
303 | 305 | | |
304 | | - | |
| 306 | + | |
305 | 307 | | |
306 | 308 | | |
307 | | - | |
308 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
309 | 316 | | |
310 | | - | |
311 | | - | |
| 317 | + | |
| 318 | + | |
312 | 319 | | |
313 | | - | |
| 320 | + | |
314 | 321 | | |
315 | | - | |
| 322 | + | |
316 | 323 | | |
317 | | - | |
| 324 | + | |
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
| |||
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
356 | | - | |
| 363 | + | |
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
| |||
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
409 | 420 | | |
410 | 421 | | |
411 | 422 | | |
| |||
453 | 464 | | |
454 | 465 | | |
455 | 466 | | |
456 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
457 | 470 | | |
458 | 471 | | |
459 | 472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments