[program-l] Re: Text file checksum code

  • From: "Mark Long" <markalong64@xxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 25 Mar 2009 11:54:45 -0000

I agree. I would use 2 hashes, MD5 and sha1. You can force a collision with MD5 but with MD5 and sha1 at the same time? Practically impossible.


Hang on... Did I just agree with Tyler? <grin>

--------------------------------------------------
From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
Sent: Wednesday, March 25, 2009 11:33 AM
To: <program-l@xxxxxxxxxxxxx>
Subject: [program-l] Re: Text file checksum code

hello,
while that works, I recommend not using md5. Could use something a bit higher in strength, but that's really up to you. Might be a good idea to check the strengths and weaknesses of hashes; I had a page, I'll have to see if I can find again that explained the strengths for certain hashes and etc.

Thanks,
Tyler Littlefield
Web: tysdomain.com
email: tyler@xxxxxxxxxxxxx
My programs don't have bugs, they're called randomly added features.

----- Original Message ----- From: "Mark Long" <markalong64@xxxxxxxxxxx>
To: "Program-l" <program-l@xxxxxxxxxxxxx>
Sent: Wednesday, March 25, 2009 2:43 AM
Subject: [program-l] Re: Text file checksum code


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

** 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: