File I/O Question

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

File I/O Question

Post 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. :)
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: File I/O Question

Post 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.
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: File I/O Question

Post 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: *
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: File I/O Question

Post 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
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: File I/O Question

Post by MarauderIIC »

Extensions are meaningless. Filetype, as in 'what can open the file,' is determined by content.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: File I/O Question

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

Re: File I/O Question

Post by zodiac976 »

Thanks for the input. I will look into encryption then.
Post Reply