Re: HMACs of files

Jeffrey Walton <[email protected]> Sat, 20 May 2023 18:48:16 -0400
Newsgroups gmane.comp.encryption.cryptopp
Message-ID <CAH8yC8k7u3f7PdhAHhACPEHVoYhEOfBM3WGP25ADZTd26PocZg@mail.gmail.com>
On Sat, May 20, 2023 at 4:45 PM Jeffrey Walton <[email protected]> wrote:
>
> On Sat, May 20, 2023 at 3:00 PM Tom <[email protected]> wrote:
> >
> > calling `FileSource fs("zero.dat", true);` seems to allocate the memory.
>
> Try the overload which takes a std::istream reference:
> https://www.cryptopp.com/wiki/FileSource

I took another look... The issue is you passed 'true' for 'pumpAll'.
That reads the entire file, and puts it in an output buffer for the
next filter.

Use 'false' instead, and then call 'PumpAll()' manually. Something
like the example. Something like this should suffice:

    FileSource fs("zero.dat", false, new Filter(..., new Sink(...)));
    fs.PumpAll();

It should pump in 4k blocks.

Jeff

-- 
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8k7u3f7PdhAHhACPEHVoYhEOfBM3WGP25ADZTd26PocZg%40mail.gmail.com.