@PiotrK seems to be the most helpful answer. I looked at the code from the link and it looks pretty good (I haven’t tried it either). However, there are two points regarding the code by reference. Firstly, Lopez da Silva (author of PiotrK link) claims that he did not create a local pool of abstracts, as this would be inefficient. This myth has been debunked. Go ahead, create and destroy the pools of abstracts, it’s cheap (although this code is probably faster). Secondly, the associated code declares a “buffer” (which should be reused) inside the while loop; it should be limited to the limits of the while loop. Most likely, the compiler will cope with this by allocating a buffer on the stack stack only once, and not per cycle. But, paradoxically, this can create the very problem that the author hoped to avoid by coding around the autorun pool.
Finally, for OP, I hope that ADD you meant streaming data through the Hash MD5 algorithm and do not intend to invent your own security algorithm. This is usually a bad idea. If you are trying to find something new in the world of security algorithms, I would call you some cryptographic books such as Applied Cryptography by Bruce Schneier. Or just clarify your question above with what you are trying to accomplish.
source share