Hi,
Is there a stream implementation or ICryptoTransform implementation similar to the md5 which simply counts bytes rather than calculates a hash.
I am writing text to an encrypted file and need to know the md5 and size of the raw unencrypted byte data. I've seen code for calculating md5 of a stream, but need one which simply counts bytes.
Something like this
// File Stream
FileStream fileStream = this.fileInfo.Open(FileMode.CreateNew, FileAccess.Write, FileShare.None);'
// Encrypter wraps File Stream
CryptoStream cryptoStream = encrypter.BuildEncodingStream(fileStream);
// Md5 wraps Encryption
CrytpStream md5Stream = = new CryptoStream(cryptoStream, md5, CryptoStreamMode.Write);
// StreamWriter wraps md5Stream
StreamWriter sw = new StreamWriter(md5Stream);
// Need to wrap md5 in 'byte counter'
// write text
sw.writeLine("text");
sw.close();
// now have md5
string md5Val = md5.Hash;
// need length
long size =
Thanks.
Cheers,
Phillip

Counting bytes passed in streams written to by StreamWriter.