Page 1 of 1

File I/O Question

Posted: Fri Jun 19, 2009 1:23 pm
by zodiac976
In most of my programs I read and write strings to text files for storage, but
I was wondering if there was a different file type besides .txt for saving data
securely like accounts, passwords, and money for example.

I have tried .dat and .bin but I am not sure about those file types. I want the
data to be very secure so no one but me can go in and edit it.

Thanks in advance as always. :)

Re: File I/O Question

Posted: Fri Jun 19, 2009 4:28 pm
by RyanPridgeon
It's called encryption.

It's basically some form of set of rules or methods that jumbles and encodes the data into a mess which would only be readable if decoded. So what you would need to do is make functions to encode data, and to decode, then encode before saving a file, and decode after loading a file to switch between encoded and normal data.

It's quite advanced to create something effective, so you might want to search and see if there are libraries out there that can help you.

Re: File I/O Question

Posted: Fri Jun 19, 2009 6:53 pm
by programmerinprogress
a simple form of encryption could be to just NOT all of the characters in the message to encrypt them, and then just NOT them again to de-crypt them, you would write a program that does this. At first glance, the message will be gibberish, but the confusion will not last long, and for even the most amateur cracker, decoding the message wouldn't exactly be a difficult task...

Manipulating the bits that make up each character can change what they represent, i'm sure if you messed around a bit, you could do something relatively interesting, although i'm no expert, and i'm sure there are better solutions, but if you're just messing about, and want a basic level of encryption, don't be afraid to try something along those lines.

*what do I know about encryption? :lol: *

Re: File I/O Question

Posted: Sat Jun 20, 2009 10:05 am
by MadPumpkin
yea... i was making a program in assembly that would encrypt .bin files... and well it worked! and other programs could still use these files... but i couldn't decrypt them (probably for lack of pointers) ... so basically
what it came down to was me taking very specifically places and putting the data somewhere else in the memory

Re: File I/O Question

Posted: Sat Jun 20, 2009 6:06 pm
by MarauderIIC
Extensions are meaningless. Filetype, as in 'what can open the file,' is determined by content.

Re: File I/O Question

Posted: Sat Jun 20, 2009 6:45 pm
by dandymcgee
MarauderIIC wrote:Extensions are meaningless. Filetype, as in 'what can open the file,' is determined by content.
They only help to auto-choose an "Open With..." application as you might call it on Windows.

Re: File I/O Question

Posted: Sun Jun 21, 2009 8:25 am
by zodiac976
Thanks for the input. I will look into encryption then.