[program-l] Re: Text file checksum code

  • From: "Mark Long" <markalong64@xxxxxxxxxxx>
  • To: "Program-l" <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 25 Mar 2009 08:43:41 -0000

If the file is of arbitrary length then it can be padded to have the same checksum. This is called a forced collision.


If you hashed it using two algorithms then it would be very much harder to do. I suggest that a sha1 and an MD5 would defeat most attackers.

Sample code:

http://dotnetpulse.blogspot.com/2007/12/sha1-hash-calculation-in-c.html
http://blog.brezovsky.net/en-text-2.html

Hope that helps

Mark

--------------------------------------------------
From: "Jacob Kruger" <jacobk@xxxxxxxxxxxx>
Sent: Wednesday, March 25, 2009 7:53 AM
To: "Program-l" <program-l@xxxxxxxxxxxxx>
Subject: [program-l] Text file checksum code

Hi there

Currently looking into implementing a form of custom licensing system for some apps for work, and the one thing we might need to do is to use some form of checksum to make sure that the text/XML file to be used for storing licensing information hasn't been modified as such, so am currently looking for some sample code/examples related to doing this with text files since it doesn't as such seem to be naturally supported within the CLR framework/C#/VB.Net.

Any ideas?

Apart from that, here's a link to MS's own updated C# code samples file download page:
http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=csharpsamples&ReleaseId=8

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: