TurboSHAKE: change default delimiter to 0x1F (#14857)

The TurboSHAKE paper just got published:
https://eprint.iacr.org/2023/342.pdf

and unlike the previous K12 paper, suggests 0x1F instead of 0x01
as the default value for "D".
This commit is contained in:
Frank Denis 2023-03-09 20:20:57 +01:00 committed by GitHub
parent 12b74b2c05
commit 95f6a5935a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ pub const Shake256 = Shake(256);
/// TurboSHAKE128 is a XOF (a secure hash function with a variable output length), with a 128 bit security level.
/// It is based on the same permutation as SHA3 and SHAKE128, but which much higher performance.
/// The delimiter is 0x01 by default, but can be changed for context-separation.
/// The delimiter is 0x1f by default, but can be changed for context-separation.
pub fn TurboShake128(comptime delim: ?u8) type {
return TurboShake(128, delim);
}
@ -96,7 +96,7 @@ pub fn Shake(comptime security_level: u11) type {
/// The TurboSHAKE extendable output hash function.
/// https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/
pub fn TurboShake(comptime security_level: u11, comptime delim: ?u8) type {
return ShakeLike(security_level, delim orelse 0x01, 12);
return ShakeLike(security_level, delim orelse 0x1f, 12);
}
fn ShakeLike(comptime security_level: u11, comptime delim: u8, comptime rounds: u5) type {