I've modified the mhash library to include a mhash_reuse interface.  This interface is intended to be used when computing checksums on a number of small, independent blocks of data and saves the overhead of malloc/free and some setup for each iteration.

It was modelled after the mhash_deinit function except rather than call free() on the state block, it simply re-initializes it using the appropriate init routine for the selected algorithm.

So far, I've only tested it with the MD5 and SHA1.  I haven't so much as looked at the other algorithms, but don't see why it wouldn't work with them as well.  On my Linux workstation, computing checksums on 1k blocks using MD5 runs about 8-10% faster than using mhash_deinit().

mh = mhash_init(MHASH_MD5);
    mhash(mh, buf, buflen);
    mhash_reuse(mh, hashbuf);  /* same effect as mhash_deinit() + mhash_init(), but faster */

mhash_deinit(mh, NULL)

Is there any interest in including this in the main distribution?  If so, I can provide patches.