[program-l] Re: Text file checksum code

  • From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 25 Mar 2009 05:36:36 -0600

such, and then also use the file size/length to make sure nothing had ben changed.
The hash should be good enough; if the length changes, the whole hash changes. It's like a fingerprint of sorts. Md5 can be changed a bit easier, but something like sha256 would be rough.


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

----- Original Message ----- From: "Jacob Kruger" <jacobk@xxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Wednesday, March 25, 2009 3:59 AM
Subject: [program-l] Re: Text file checksum code


Ok.

Checked a bit more, and seems it's not possible to revert back to unencrypted value, so you would have to simply compare encrypted values as such, and then also use the file size/length to make sure nothing had ben changed.

Stay well

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

----- Original Message ----- From: "Mark Long" <markalong64@xxxxxxxxxxx>
To: "Program-l" <program-l@xxxxxxxxxxxxx>
Sent: Wednesday, March 25, 2009 10: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: