Hash File Stream ?

  • Thread starter Thread starter Sebastian Dau
  • Start date Start date
S

Sebastian Dau

Hello,

I'm writing a security related application in .NET 1.1
and I wonder how I compute hashes from very large files (up to 1 GB).

Does anybody know a good pattern of how to create a stream from a binary
file
and compute the hash of it?


I appriciate your comments.
Thanks in advance, Sebastain Dau.
 
Sebastian Dau said:
Hello,

I'm writing a security related application in .NET 1.1
and I wonder how I compute hashes from very large files (up to 1 GB).

Does anybody know a good pattern of how to create a stream from a binary
file
and compute the hash of it?


I appriciate your comments.
Thanks in advance, Sebastain Dau.


Thread is closed... I got it.

SHA256Managed* hash = new SHA256Managed ();
String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
File::OpenRead ( "c:\test.txt" ) ));
 
Hi Sebastian!
SHA256Managed* hash = new SHA256Managed ();
String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
File::OpenRead ( "c:\test.txt" ) ));

I dodnßt know if this is a good idea for large files ( > 1GB)...
For this you need to read small pieces of the file and incremently
create the hash...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
I dodnßt know if this is a good idea for large files ( > 1GB)...
For this you need to read small pieces of the file and incremently create
the hash...

Right, that's exactly what it's doing...

ComputeHash takes a stream object and internally hashes block by block
File::OpenRead returns such a Stream inherited object.

Greetings, Sebastian
 
Back
Top