Large Files And Hashing
From: chis2k (sfd_at_sdf.com)
Date: 07/26/03
- Next message: Jerry Bryant [MSFT]: "Updated Information Regarding Microsoft Security Bulltin MS03-026"
- Previous message: Keith Patrick: "Re: Basic permission attribute question: RequestRefuse"
- Next in thread: Robbie Harris: "Re: Large Files And Hashing"
- Reply: Robbie Harris: "Re: Large Files And Hashing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 25 Jul 2003 15:36:08 -0700
I need help figuring out how to get the MD5 hash of large files.
I cannot go about the traditional way of reading the entire file into a byte
array, because then the huge file is placed in memory, and bye bye system
resources! I know there might be way using streams, but I am unsure how to
implement it. Can anyone give me an example?
I've tried this but it didn't work, it still loaded the entire blasted thing
into memory!.
public byte[] GetMD5HashFromFile( string file_name) {
FileStream file = new FileStream( file_name, FileMode.Open );
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file);
file.Close();
return retVal;
}
- Next message: Jerry Bryant [MSFT]: "Updated Information Regarding Microsoft Security Bulltin MS03-026"
- Previous message: Keith Patrick: "Re: Basic permission attribute question: RequestRefuse"
- Next in thread: Robbie Harris: "Re: Large Files And Hashing"
- Reply: Robbie Harris: "Re: Large Files And Hashing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|