Using libgcrypt on large files

Johan Rydberg jrydberg at gnu.org
Thu Feb 24 06:44:23 CET 2005


Ralf H <gcrypt at kaervek.net> writes:

> Hello,
> [...]
> Even though I would not use quite large files at the beginning, I am not
> sure if this will always be true.
> 1) I want to sign binary data, to use the code above, I would have to
> escape/remove nulls, otherwise gcry_sexp_build will fail. Is there any
> other function I could use instead? Performance wise this looks a little
> bit suspicous to me.
>
> 2) What can I do if the file is really large and will not fit into
> memory? My approach will obviously fail, as I need everything in
> 'data' :(. Is there a way to hash a file in little portions, so I can
> read in buffers and update my signatures in a loop?

I suggest that instead you just sign, for example, a SHA-1 hash of the
file contents.

~j




More information about the Gcrypt-devel mailing list