SHA256: Inconvenient for chunk processing

The juce::SHA256 interface is incredibly inconvenient if you want to pass small blocks of data at a time instead of having the class do everything for you. In my case, I need to support thread interruption, so I planned on feeding the small blocks of a FileInputStream wrapped in a BufferedInputStream.

But there’s no way to do that! SHA256 insists on constructing with the hash already computed. One constructor takes a “maxBytesToRead” but that’s no good, because I need to keep going with the rest of the data in between periodically checking for a thread interruption.

Am I missing something here?

Yeah, I wrote it as a “pull” design because that’s what I needed at the time, but it’d need a few extra tweaks to work in a “push” mode too, which wouldn’t be too hard to add, but is just one of those things I’ve never gotten around to…