[Mono-list] Question about encoding and tricky stuff.

Christopher David Howie me at chrishowie.com
Mon Aug 23 21:18:40 EDT 2010


On 08/23/2010 08:25 PM, Rampage wrote:
> this way the hash matches perfectly but obviously once the stream is read
> it's gone, and since i need both to render the image and calculate the md5
> it's going to be an issue.
> 
> do you have anything to suggest me?

Stream stream; // this is your input stream

var md5 = MD5.Create();
using (var wrap = new CryptoStream(stream, md5,
                                   CryptoStreamMode.Read)) {
    // Process the "wrap" stream how you would process the original data
    // stream.

    wrap.FlushFinalBlock();

    // The "md5" object contains the hash state.
}

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

If you correspond with me on a regular basis, please read this document:
http://www.chrishowie.com/email-preferences/

PGP fingerprint: 2B7A B280 8B12 21CC 260A DF65 6FCE 505A CF83 38F5

------------------------------------------------------------------------
                    IMPORTANT INFORMATION/DISCLAIMER

This document should be read only by those persons to whom it is
addressed.  If you have received this message it was obviously addressed
to you and therefore you can read it.

Additionally, by sending an email to ANY of my addresses or to ANY
mailing lists to which I am subscribed, whether intentionally or
accidentally, you are agreeing that I am "the intended recipient," and
that I may do whatever I wish with the contents of any message received
from you, unless a pre-existing agreement prohibits me from so doing.

This overrides any disclaimer or statement of confidentiality that may
be included on your message.


More information about the Mono-list mailing list