Re: SHA1 Hash question with large Files

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.


.



Relevant Pages

  • SHA1 Hash question with large Files
    ... I guess I don't fully understand how a SHA1 hash value is calculated ... the large file, passing it to a byte array, and passing the byte array ... Does this load the entire file into main memory ...
    (microsoft.public.dotnet.languages.csharp)
  • Create word doc from a memory stream NO file stream used
    ... Is there a way in C# to create a word object directly from a memory ... stream without passing that to hard disk (file stream). ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: hash table size
    ... talking about chess programming ideas and what they do rather than actually ... you can clear out the memory. ... Just a couple cycles per hash check. ... The amount of physical memory each user gets is likely to be somewhat ...
    (rec.games.chess.computer)
  • Re: hash table size
    ... Change all the hash keys so you get a new random value. ... This way old entries from the previous search (or uninitialized hash memory) ... It is true that doing an AND is faster than a modulo. ... If you are runing a chess program for a reason, ...
    (rec.games.chess.computer)
  • Re: Firewall vs. IPS - Differences now (ISS, Intrushield 2.1?)
    ... > You risk running out of memory. ... That's like saying "it's trivial to DoS Aho-Corasic if you know the ... DoS's and improvements via use of the Jenkins hash are most illuminating. ... > replacement policy gives the worst behavior since an attacker can flood ...
    (Focus-IDS)