aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_degeneralise_spec.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-26 23:37:23 +0100
committerMattias Andrée <maandree@kth.se>2022-02-26 23:37:23 +0100
commit0538b8a3ec95b746a7e8c9e5448b3b9f7d82f008 (patch)
treee4df1fc3d329ee327c01192f6a285c32ffcbf08a /libkeccak_degeneralise_spec.c
parentBump lib minor number (diff)
downloadlibkeccak-0538b8a3ec95b746a7e8c9e5448b3b9f7d82f008.tar.gz
libkeccak-0538b8a3ec95b746a7e8c9e5448b3b9f7d82f008.tar.bz2
libkeccak-0538b8a3ec95b746a7e8c9e5448b3b9f7d82f008.tar.xz
Keccak[] is not defined via its output size, but it is only explicitly defined for Keccak1600, so proportional for rest
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libkeccak_degeneralise_spec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libkeccak_degeneralise_spec.c b/libkeccak_degeneralise_spec.c
index 99c8e00..efe5127 100644
--- a/libkeccak_degeneralise_spec.c
+++ b/libkeccak_degeneralise_spec.c
@@ -90,14 +90,13 @@ libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict spec, st
}
} else if (have_bitrate + have_capacity == 1) {
state_size = deft(state_size, 1600L);
- bitrate = deft(bitrate, state_size - capacity);
capacity = deft(capacity, state_size - bitrate);
+ bitrate = deft(bitrate, state_size - capacity);
output = deft(output, capacity * 2L <= 8 ? 8 : capacity * 2L);
} else {
state_size = deft(state_size, 1600L);
- output = deft(output, (state_size * 32L / 100L + 7L) & ~7L);
- bitrate = 2L * output;
- capacity = state_size - bitrate;
+ capacity = state_size * 9 / 25;
+ bitrate = state_size - capacity;
output = deft(output, bitrate / 2L <= 8 ? 8 : bitrate / 2L);
}