Home All Groups Group Topic Archive Search About

How to hash a file stream?

Author
6 Jun 2005 6:02 PM
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.

Author
6 Jun 2005 6:34 PM
Yunus Emre ALPÖZEN [MCSD.NET]
have u tried SHA ?? I don't know whether works for large files up to 1GB.
But it should be...
SHA512 produces a 512 bit hash value...

Also it supports streams...

ComputeHash method accepts a stream to compute hash value...

--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

Show quoteHide quote
"Sebastian Dau" <sebastian.***@gmx.de> wrote in message
news:42a48fbd$0$307$4d4ebb8e@read-nat.news.de.uu.net...
> 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.
>
Author
7 Jun 2005 10:41 PM
baylor
> how I compute hashes from very large files (up to 1 GB).

i haven't tried the System.Cryptography.SHA1Managed class on a file (i has
passswords which are byte[], not streams), but my guess is that you could use
that

SHA will produce a 20 byte hash (unless you add salt) from any source up to
2,097,152 TB (give or take, depending on whether you divide by 1000 or 1024).
So the algorithm is fine as far as size goes. But like i said, i haven't
tried it. If the implementation buffers it all first (which i doubt) you
could run out of RAM. But i'm betting you'll be OK

-baylor