SHA256: Inconvenient for chunk processing

Discussion and support for general JUCE issues

SHA256: Inconvenient for chunk processing

Postby TheVinn » Sat May 05, 2012 3:37 am

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?
Open Source: LayerEffects, VFLib, SimpleDJ, DSP Filters, LuaBridge, JUCE, FreeType, TagLib
"This isn't a big project, it shouldn't take long." - Jules
User avatar
TheVinn
JUCE UberWeenie
 
Posts: 2976
Joined: Sat Aug 29, 2009 11:31 am
Location: Marina del Rey, California

Re: SHA256: Inconvenient for chunk processing

Postby jules » Sat May 05, 2012 10:06 am

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..
User avatar
jules
Fearless Leader
 
Posts: 17204
Joined: Mon Sep 06, 2004 9:03 am
Location: London, UK


Return to General JUCE discussion

Who is online

Users browsing this forum: No registered users and 3 guests