in reply to Re: Deleting EOF from a file
in thread Deleting EOF from a file

Yikes.
Don't do this.
If you want to protect a file from modification, use file permissions.
If you want to make the contents more difficult to read, encrypt the file.
If you want to store a secret value (eg, a password), and test to see if the user has supplied the correct value, hash the contents using something like Digest::SHA1, then test the user-supplied value by passing through the same hashing procedure.

Note that the first two options won't stop a determined user from doing what they want. They can change file permissions. They can inspect the file's content when your software decrypts it, plus your software would also have to store the decryption key somewhere, allowing decryption.

We'd need more information about what you're trying to do to be able to advise you further. As an aside, attempting to make other software crash is rude and arrogant at best


davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.