On Jan 25, 6:30 pm, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
> > I feel it's impossible... :(
> Not impossible - you simply have not found an adequate solution.
There is other design solution, so it's not compatible with my
requirements.
> > It reads whole file into the rslt, all goes into memory.
> > I try to avoid it.
> How would you do this _without_ the compressed or encrypted stuff?
Read a small chunk into memory from the file, parse it, then decide if
I need it, if don't - just free the memory. Then read a next chunk and
so on. It is very popular approach to make streaming data. I showed
boost::iostreams sample above, here you can call fis.read many times
with small buffer, and whole file doesn't need to be in the memory,
only a buffer enough for processing (e.g. block cipher needs less than
100 bytes contiguously in memory, zlib needs 32 kbytes or so). So if
you want to decrypt and decompress 500 Mb file, you probably need only
100kb of memory.
Moreover, this conception allows to make "infinite" streams, which
never end, e.g. RandomNumberSource can produce output as much as Sink
want take.
> > ctx->pump->Pump(1234);
Instead of it I made more clever code, but anyway it looks weird
while(ctx->source->MaxRetrievable() < len)
{
if(ctx->pump->Pump(len / 5 + 1) == 0) break;
}
> http://www.cryptopp.com/fom-serve/cache/29.html
I read it already ;)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---