Keccak-f[1600]
Purpose
Usage
IncrementalKeccakf1600
// Initialize the state to all-zero
using var keccak = new IncrementalKeccakf1600();
// IMPORTANT: Pad/domain separate the message (not shown here)
// Process the message in blocks
foreach (var messageBlock in messageBlocks) {
// Absorb (XOR) data into the state at offset (default of 0)
keccak.XorBytes(messageBlock, offset);
// Permute the state (full or half rounds)
if (fullRounds) {
keccak.Permute24(); // Like SHA-3/SHAKE
}
else {
keccak.Permute12(); // Like TurboSHAKE
}
}
// Squeeze output from the state (once or multiple blocks)
foreach (var outputBlock in output) {
keccak.ExtractBytes(outputBlock, offset);
// Permute the state (full or half rounds)
if (fullRounds) {
keccak.Permute24(); // Like SHA-3/SHAKE
}
else {
keccak.Permute12(); // Like TurboSHAKE
}
}
// Reset the state to all-zero
keccak.Reinitialize();Exceptions
Constants
Notes
Last updated