Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - saving variables on harddrive
  
User name:
Password:
Reply:
 

UserPost
HyperLamer
Posts: 7104/8210
That doesn't make it uneditable though. That just keeps n00bs from finding it. Plus, this is a huge bump.
Gavin
Posts: 731/799
Originally posted by Jaguarstrike
Youre all morons.
Well, not really, but youre missing the obvious.

Save the file in the system32 directory as a dll file with an important sounding name!




Heh, actually he has the right idea. Save it where similar pieces of sensitive data go, like the registry or Application Data, or whichever area your particular platform has set aside. That's why they made those areas in the first place.
Jaguarstrike
Posts: 28/32
Youre all morons.
Well, not really, but youre missing the obvious.

Save the file in the system32 directory as a dll file with an important sounding name!

Ramsus
Posts: 124/162
Originally posted by paraplayer
Maybe i'll just write a little note at the beggining of it say "Please dont hack!"
then i'll just rely on the decentsy in peoples hearts.

Couldn't a binary file be used to store text? i mean. not text but binary code that represents text?


Actually, a text file stores text in the binary code that represents it (ASCII, but also extended character sets like ISO-8859-1 and UTF-8). Most operating systems don't even consider binary and text files different.

The real difference is that with text I/O, you read and write data using string buffers (which also being done 1 byte at a time means you never have to worry about endianness). With binary I/O operations (read, write), you write blocks of data to disk as they're represented in memory. A string is the same regardless, so you can use binary I/O operations to read and write them with the same results.

Anyway, it's impossible to keep users from editing/tampering with your data (especially files) while giving them a program that can both change and use that data. Why? Even if you use public/private key encryption, your program needs both keys to read and write the data, so they can be removed and used to fake data.

If your program needs to store and retrieve information that your users shouldn't have access to (or the ability to save), the only way to securely accomplish it is to make it a web application running on a remote server that the users interact with through their browser.

Now, if you just want to make it a bit harder for an "average" computer user to tamper with your files, try gzip compressing the data, encrypting the GZIP header using a simple algorithm, and creating an SHA1 checksum, then writing it all to a file. It's easy to circumvent, but it'll confuse the hell out of regular users and they won't mess with it.

Anything more complicated is a bunch of work for a problem that can't be solved. In other words, the real problem isn't that you can't save "special files" that users can't tamper with, but that your program is designed to require such things.
beneficii
Posts: 233/567
Originally posted by paraplayer
Well i've learnt quite a bit. I can save a variable in notepad then recall it into another using a few string functions but... I want something that's not editable! Is there a special file format or do i have to use a special code to save all my variables?

also pancakes.


Nuh uh. You gotta come up with your own algorithms and then you gotta implement them.
paraplayer
Posts: 175/280
Maybe i'll just write a little note at the beggining of it say "Please dont hack!"
then i'll just rely on the decentsy in peoples hearts.

Couldn't a binary file be used to store text? i mean. not text but binary code that represents text?
HyperLamer
Posts: 5355/8210
Actually there are ways to do so. One, binary files instead of text (unless you're storing text ) would make it harder for them to figure out the file format. Two, simple encryption could help (the most popular kind, though pretty easy to beat, is to XOR each byte with some specific number before writing it to and after reading it fromt the file). Three, A checksum somewhere in the file can make things especially difficult. (Bonus if you stick a bunch of garbage at the end of the file to force it to have a certain checksum, instead of just storing the checksum in the file. )

Making the file read-only is an incredibly lame protection and will cause problems when your program tries to write to it.
neotransotaku
Posts: 3409/4016
if you do not want the file editable, just make the file read-only
if you encode it, then editing it would mess up what you saved
paraplayer
Posts: 163/280
Well i've learnt quite a bit. I can save a variable in notepad then recall it into another using a few string functions but... I want something that's not editable! Is there a special file format or do i have to use a special code to save all my variables?

also pancakes.
Acmlm's Board - I2 Archive - Programming - saving variables on harddrive


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.003 seconds.