Re: Possible to write CRC/MD5 to the file?
| From: | Evan Nemerson | Date: | Mon, 23 Feb 2004 05:01:17 +0000 |
| Subject: | Re: Possible to write CRC/MD5 to the file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178510@lists.php.net to get a copy of this message | ||
On Sunday 22 February 2004 08:20 pm, Simon Fredriksson wrote:
> I wonder if it's possible to write the MD5 or CRC checksum of my
> scriptfile to the scriptfile. I know that if I change it, the value will
> change, but is there any way to calculate what it will be?
What you would have to do is find a collision, which is thankfully difficult
to do- if it were easy, MD5 would be useless. Theoretically, you could modify
say John The Ripper and have it brute force something, but you may end up
waiting a few lifetimes :)
>
> Not just displaying it for the user, but actually having it written in
> the file. Could be pretty usefull when distributing scripts. No worries
> about losing the md5-file or sfv, etc.
I'd recommend PGP/GPG signing instead- anyone can create a valid MD5 checksum,
but only you can cryptographically sign your files (theoretically- if someone
else can, you've got serious problems)
Everyone seems happy enough with detached signatures. Also, you could use the
OpenPGP specification to do what you want, just like when you send a
PGP-signed e-mail the signature and the message are all in a single
container. You may have to hack GPG a bit (not as difficult as you'd think)
to have the PGP stuff in PHP comments, but i think you could do it... Sorry,
I'm rambling.
>
> Just some thoughts.
>
> //Simon
--
Evan Nemerson
evan@coeus-group.com
http://coeusgroup.com/en