Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
gentry_joey
21
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 29th Apr 2004 08:30 Edited at: 29th Apr 2004 09:26
Hi I would like to know how to make my own file types so people are unable to steal media and use in their own programs. I am guessing I would need to encrypt everything correct? I want only my program to be able to read the files. I got a snippet that Raven made (i dont know if he is still around). I would appreaciate it if people can explain encrypting (using DB) to me in an easy manner. I learn very fast so it shouldn't be too hard. I would also like to know how I would implement this into my program.

IBOL
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 29th Apr 2004 11:10 Edited at: 29th Apr 2004 11:17
i am curious why you are asking this question,
when the example you provided yourself,
to answer your own question,
is more complicated than what i am going
to suggest anyway...

basically,
for encryption,
i would perform a constant mathematical operation
on every bit of data i save,
and then , when it's re-loaded,
you perform the inverse of that operation
to decrypt.

you can get intricate with this, of course,
and store a "KEY" in within a string of nonsense
characters at the header of your files...
and the key is always the "Nth" character in the
string, and the key represents one of several methods
of encryption/decryption.

a very simple example from one of my programs:

write word 1,(star(t).z+15)
write word 1,star(t).r+17
write LONG 1,star(t).t*10
write STRING 1,encrypt(PLANET(T,O).N)

and you would always subtract 15
from the first, sub 17 from the second,
divide the third by 10, and run function DECRYPT on the string
to decrypt them

here's my on-the-fly-coded ENCRYPT
(i haven't tested it but the theory is sound)

FUNCTION ENCRYPT(A$)
C$=""
FOR T=1 TO LEN(A$)
B$=MID$(A$,T)
Q=ASC(B$)
Q=Q+60+(T*2)
C$=C$+CHR$(Q)
NEXT T
ENDFUNCTION C$

that was actually fun to think about.
it modifies each character in the string by a mathematical operator that changes for each character...

now you figure out the DECRYPT ... !

hope that helps,
bob
IBOL
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 29th Apr 2004 22:30
huh,
doesn't anyone have anything else to say on this?
is it illegal or something?
sponge008
21
Years of Service
User Offline
Joined: 8th Feb 2004
Location: MA, USA
Posted: 29th Apr 2004 22:52
No...actually, how do you make your own file types?
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 29th Apr 2004 23:11
hmm.. in Bouncing Ball, I use fileblocks ; it isn't very safe, but only a programmer can steal my medias - and I don't think many people would like spending time to see how to decompile fileblocks

you can use fileblocks and then crypt them with xor - but that would be a bit slow if you use large files

how to crypt a file with xor ? hmm.. I won't test, I just write an example which may work ^^



and how to decrypt ? just change the filenames => xor crypt and decrypt

hmm.. sometimes, I write things very useless (useless^3 ), I hope this message wasn't ^^

The sleeper must awaken !
Class I Coder
21
Years of Service
User Offline
Joined: 11th Apr 2004
Location:
Posted: 30th Apr 2004 01:21
Cryptography is a nastily mathematical subject based largely on number theory. If you're still reading this far - congrats

Unfortunately there is only one cipher that is mathematically proven to be unbreakable - the Vernam Cipher (ie the 'one time pad'). The other ciphers are breakable, but the key question is 'how long would it take to break?'. The examples given above (no offence intended guys) would be trivial. For example...

(1) IBOL's first example looks like an affine cipher...not hard to break.
(2) Atreides XOR - if the key is the same length as the plaintext then you have a vernam cipher. If the key is shorter, weeeelllll....look at www.phreedom.org/solar/honeynet/scan16/scan16.html for how to make it more difficult to cryptanalyse. However, XOR's aren't ideal by themselves (understatement).
(3) Ravens code - I'm a C++ programmer, new to DB. As I read it this prog just swaps the bits around. Out of all of the methods so far this would be the hardest to break. This isn't saying much however, as it is still weak and a bit of lateral thinking would break this.

A strong cipher is only as good as the program it's in. If I wanted to 'break' a cipher I'd simply crack the program instead as it is the easier option. Look at SoftIce, IDA Pro...

For more info read 'Hacker Disassembling Uncovered' by Kris Kaspersky - very good book about how to crack programs (working on the 'know your enemy' premise). There are various books on cryptography, but one of the easiest to read is 'Applied Cryptography' by Bruce Schneier. The rest are a very 'dry' textbooky read, even if you are interested in number/information theory.
IBOL
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 30th Apr 2004 01:38
as far as making your own file types,

as long as you know how to use the
WRITE BYTE and READ BYTE things in DB,
(and read string,word,etc.)
then you can save your file using
ANY EXTENSION YOU WANT.
the file will BE a text file,
but the way db writes things
it can look pretty crazy,
and if you care to apply some
sort of encryption to your strings,
it will look pretty unique.

i do not think encryption is NECESSARY,
just a fun topic.

later on down the line, there will probably
be ways to have your .exe apply a unique
ICON to your new file types, but i haven't gotten
that far yet...

bob

(and my code was meant to be simple...
it would confuse someone who was just looking
at stuff encrypted with it, but i admit, it would hardly stand
up to sophisticated code-breaking...)
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Apr 2004 01:54
There is no point on going overboard on encryption - everything that someone needs to decrypt your media is included in your program.

A simple encryption can be used to stop the casual ripper, but anyone beyond that level isn't going to be stopped by anything that you do.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 30th Apr 2004 04:42 Edited at: 30th Apr 2004 04:48
Just put your media in a password protected cab file if you're so convinced that someone's going to rip off your crummy jpegs.

I mean, realistically...Most game developers don't protect their media anymore. Mostly because one of the selling points to alot of games these days is modification.

Unless it's mission critical data, I would say that you're wasting your time and effort on designing a proprietary file format.

That said, if you still have your heart set on doing this you could use SHA-256 hash or a variant of the same idea. Do a google search for SHA-256. I'm sure you'll find some visual basic application source code that utilises this for sure.

Quote: " Timesoft - Your wife is death. How? NO idea.
But it is murder. REVENGE!!!!!!!!!"

Hands down the funniest synopsis for a game ever. All your base are belong to us!
gentry_joey
21
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 1st May 2004 09:01
Personnally I dont care if people have my images and what not. I would just like to have MY own file extenstions so the average "joe" cant just take my 3ds file or .x file and other media and do with how he likes. If a guy really wants it great crack it and its yours. I like the idea of file extenstions and would like to keep them as a compression format kinda like EA does with their games like Battlefield series and so on. This will be great for my game in the future if I decide to release modding utilities for my game. Encrytion is and was probably too far to go. Compression and File extenstions is more like it. I want a file people cant open in 3ds max unless they have a utility to do so but at the same time be put into a archive file to minimize the amount of files I have and to help clean up my program. This is what Im aiming for. While I been trying to find out how to do this I came across encryption and thought thats what I needed to do but its not. I do like the idea of encryting though because it looks really cool and probably fun to do.
eat much pie
21
Years of Service
User Offline
Joined: 9th Apr 2004
Location: Within the mind of a lowly mortal...
Posted: 2nd May 2004 01:22
On the project assistant thing-a-mag-ig, there's an option to encrypt attached media. Wouldn't this be the simplist way to throw off the lazy ripper?

One by one, the penguins are stealing my sanity...
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 2nd May 2004 01:25 Edited at: 2nd May 2004 01:26
Well, I didn't mean crummy as in quality...I ment that it's kinda a petty issue.

Like I said though, you could try 256bit encryption. Nobody's going to waste their time cracking 256bit encryption. SHA-256 hash.

Quote: " Timesoft - Your wife is death. How? NO idea.
But it is murder. REVENGE!!!!!!!!!"

Hands down the funniest synopsis for a game ever. All your base are belong to us!
Class I Coder
21
Years of Service
User Offline
Joined: 11th Apr 2004
Location:
Posted: 2nd May 2004 02:28
If you want to do your own thing for fun, or entertainment or wotnot - I think you've picked an interesting challenge. If your just looking to solve a problem then here are a few ideas...

If you want compression look up Zlib (www.gzip.org/zlib), it's open source and free (and available as a .dll). If you want to write your own and know very little I'd start by looking up Huffman compression to ease you into the subject, then move on to sliding dictionary compression (zip files use this). If you combined compression with some obsfucation (eg XORing), this should be able to put off most people and require little effort.

Have you considered writing a media packer? It's a program that puts all of your media files into a single 'resource' file. The file can then be compressed and therefore made harder to read by a cracker.It reduces the number of files you have to distribute. It also allows you to retrieve the file that you want by name without any messing about with offsets etc. If you want more info read 'Game Coding Complete', it's got a chapter devoted to this. He mentions a (commercial) program called iPac. Maybe this would be simpler? Actually, maybe this could be my next project?

If you're going to write your own format, how are you going to parse it? There is a trade off between file format flexibility and parsing complexity. If you need a hand with any parsing let me know - I cannot code DB to save my life but i do know C++ so could supply a .dll to do the job (within reason !!!).

Login to post a reply

Server time is: 2025-05-28 05:45:46
Your offset time is: 2025-05-28 05:45:46