Hi,

At 04:20 23/02/2004, 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?

There's no way you can add the CRC after calculating it without modifing the CRC for that file. If you add the CRC after you have calculated it, you are indeed modifing the file, so the CRC would change.


If you want to just check the script file itself, you can create a custom CRC calculation for your scripts that calculates it just for a section of it:

<?php
        $thisScriptCRC = 'XXXXXX';

        //{CRC-START}
        ... your script stuff here
        //{CRC-END}
?>

Just calculate the CRC between the tags and add it. Be sure you don't modify the contents between the tags (carriage returns, etc), since it will change the CRC of the file.

Also remember that the CRC will change if you upload the file through FTP in ASCII mode between Windows/Linux, so the CRC check will also fail.

Sean McCarthy

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to