Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

Hash File Stream ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian Dau - 06 Jun 2005 19:02 GMT
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.
Sebastian Dau - 07 Jun 2005 11:30 GMT
> Hello,
>
[quoted text clipped - 7 lines]
> I appriciate your comments.
> Thanks in advance, Sebastain Dau.

Thread is closed... I got it.

SHA256Managed* hash = new SHA256Managed  ();
String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
File::OpenRead ( "c:\test.txt" ) ));
Jochen Kalmbach [MVP] - 08 Jun 2005 06:25 GMT
Hi Sebastian!

>>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).
[quoted text clipped - 5 lines]
> String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
> File::OpenRead ( "c:\test.txt" ) ));

I dodnßt know if this is a good idea for large files ( > 1GB)...
For this you need to read small pieces of the file and incremently
create the hash...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

Sebastian Dau - 09 Jun 2005 08:33 GMT
>> SHA256Managed* hash = new SHA256Managed  ();
>> String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
[quoted text clipped - 3 lines]
> For this you need to read small pieces of the file and incremently create
> the hash...

Right, that's exactly what it's doing...

ComputeHash takes a stream object and internally hashes block by block
File::OpenRead returns such a Stream inherited object.

Greetings, Sebastian
Jochen Kalmbach [MVP] - 09 Jun 2005 09:02 GMT
Hi Sebastian!
>>>SHA256Managed* hash = new SHA256Managed  ();
>>>String* sHashVal = UTF8Encoding->GetString ( hash->ComputeHash (
[quoted text clipped - 5 lines]
>
> Right, that's exactly what it's doing...

Upps... yes, you are right... sorry for the confusion...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.