137 size_t bytes_to_process,
140 if(bytes_to_process == 0) {
144 constexpr auto word_bytes = SpongeT::word_bytes;
145 const auto byte_rate = sponge.byte_rate();
146 auto& S = sponge.state();
147 auto& cursor = sponge._cursor();
150 const auto bytes_out_of_word_alignment =
static_cast<size_t>(cursor % word_bytes);
151 if(bytes_out_of_word_alignment > 0) {
152 const auto bytes_until_word_alignment = word_bytes - bytes_out_of_word_alignment;
153 const auto bytes_from_input = std::min(bytes_to_process, bytes_until_word_alignment);
156 S[cursor / word_bytes] = modifier_fn(S[cursor / word_bytes],
158 .offset = bytes_out_of_word_alignment,
159 .length = bytes_from_input,
161 cursor += bytes_from_input;
162 bytes_to_process -= bytes_from_input;
164 if(cursor == byte_rate) {
176 while(bytes_to_process >= word_bytes) {
179 while(bytes_to_process >= word_bytes && cursor < byte_rate) {
181 cursor += word_bytes;
182 bytes_to_process -= word_bytes;
185 if(cursor == byte_rate) {
195 if(bytes_to_process > 0) {
196 S[cursor / word_bytes] = modifier_fn(S[cursor / word_bytes],
199 .length = bytes_to_process,
201 cursor += bytes_to_process;