Re: SHA1 Hash question with large Files
- From: "William Stacey [MVP]" <staceyw@xxxxxxxx>
- Date: Thu, 28 Jul 2005 01:22:18 -0400
One of the overloads for ComputeHash() takes a Stream object. Just pass the
file stream to this and it will run over the file and compute the hash
without loading it all into memory. You could do the same thing yourself
for a for loop, but it is already there. HTH
--
William Stacey [MVP]
"Michael H" <gfemail@xxxxxxxxx> wrote in message
news:e1kge1l3oasu0j3qeufu8jb1qabk8j8v2g@xxxxxxxxxx
>
>
> Hi all,
>
> I guess I don't fully understand how a SHA1 hash value is calculated
> in C# / .NET for a large file... I'm trying to calculate SHA1 values
> for large files that are much larger than my physical main memory. It
> seems the way to derive a SHA1 value involves opening a file stream to
> the large file, passing it to a byte array, and passing the byte array
> to the .NET hash method.
>
> Does this load the entire file into main memory (within the byte[] )
> ??? I see hash values for DVD isos all the time and feel that there
> must be a way to derive a hash value via passing a file stream to the
> hash method whereas very low main memory consumption occurs.
>
> Any help or pointers to documentation that addresses this would be
> super great.
>
>
> Thanks,
>
>
> Mike.
.
- Follow-Ups:
- Re: SHA1 Hash question with large Files
- From: Michael H
- Re: SHA1 Hash question with large Files
- References:
- SHA1 Hash question with large Files
- From: Michael H
- SHA1 Hash question with large Files
- Prev by Date: Re: How to use C++ class from .NET ?
- Next by Date: Re: Type conversions question
- Previous by thread: RE: SHA1 Hash question with large Files
- Next by thread: Re: SHA1 Hash question with large Files
- Index(es):
Relevant Pages
|