Am I doing this right. Hashing a text file
From: Anders Jansson (anders.jansson_at_araelektroniks.se)
Date: 05/25/04
- Next message: Stephen McCloskey [MSFT]: "Re: RSACryptoServiceProvider decrypt with public key"
- Previous message: Svein Terje Gaup: "Re: Persist login does not work"
- Next in thread: Anders Jansson: "RE: Am I doing this right. Hashing a text file"
- Reply: Anders Jansson: "RE: Am I doing this right. Hashing a text file"
- Reply: Henning Krause: "Re: Am I doing this right. Hashing a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 24 May 2004 15:21:04 -0700
Hi!
Just wanted a confirmation about hashing an entire file correctly.
Does this code really read all bytes from the file while calculating the hash value?
--Code MC++ start
Byte [] HashFile(String fileName)
{
if (File::Exists(fileName))
{
System::IO::FileStream * file = File::OpenRead(fileName);
// This is one implementation of the abstract class MD5.
MD5 md5 = new MD5CryptoServiceProvider();
return = md5.ComputeHash(file);
}
}
--Code MC++ end
/Thanks
- Next message: Stephen McCloskey [MSFT]: "Re: RSACryptoServiceProvider decrypt with public key"
- Previous message: Svein Terje Gaup: "Re: Persist login does not work"
- Next in thread: Anders Jansson: "RE: Am I doing this right. Hashing a text file"
- Reply: Anders Jansson: "RE: Am I doing this right. Hashing a text file"
- Reply: Henning Krause: "Re: Am I doing this right. Hashing a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|