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
Eponick
23
Years of Service
User Offline
Joined: 18th Mar 2003
Location:
Posted: 24th Mar 2003 03:47
I was just wondering how I could encrypt text files and be able to read them with DBP. Like for maps and things, so if you made a big rpg, People couldnt just change a number in the map file and put grass where a locked door should be.
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 24th Mar 2003 10:17
you could make the text files in dbpro by saving the data as arrays. and make up a file extenion. That would stop people from thinking that that file was a level data file. although if your info is opened in notepad by changin the filter to all files and chaninging the encoding you can read it in notepad.
but at least if your files are not shown as notepad files by writting them in dbpro not many people will think of opening them! As for encrypting i dont know
[img][/img]

I have a word of advice...
..don't piss on an electric fence!
Magefire
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 24th Mar 2003 18:25
If you're using a .bsp file, I havn't checked it out yet but I don't think that it would look like a normal file. You would probably rather us a hex editor to edit the .bsp files. If you accidentally or on purpose changed something on that file, I don't think grass or a weird object would appear. As you might know, encrypting requires some complex algorithims which I don't think I or very many people could figure out. I did hear somewhere that they prime numbers are used a lot in encryption codes. You might just want to do an internet search for encryption algorithims.

If you give a man some fire, he will be warm for a day. If you set a man on fire, he will be warm for the rest of his life.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Mar 2003 18:57
encryptions difficulty depends on how hard you want it to be to break
now this goes from being simple byte shifting (which is a common technique)



i mean the whole thing is pretty simple all it does is take each byte
converts to a binary %1010 1010 and then swaps the 2nd and 4th bits
so %1010 1010 becomes %1011 1000
there is a way to do this differently with real values (as i'm sure you'll figure out) and it only actually encrypts 2 out of 4 values

i mean you can add more swaps, or put in a mathematical encryption, this is just the quickest way i could show you... and if you want to decrypt then all you do is swap the files you read and write to.

if you put the file into a memblock you can actually read and write to the same file (^_^)
and ofcourse the function returns 1 if ther is a problem

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
DangYankee
23
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 24th Mar 2003 21:57 Edited at: 24th Mar 2003 22:07
Not really encrypting but I think this would work.
I probally wrong on this but I was reading about the zip extentions , why couldn't you just put whatever you wanted in a zip file with a password. That would be a simple approch if what I read about it I got right. See- the zip extention. Thought it said you could do this to protect your data .If Iam wrong sorry,
yankee.

It's not the size of your code but how efficiently you use it!
JamesBlond
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Germany
Posted: 24th Mar 2003 23:00
I just uploaded a code snippet in the 20-line-challenge. It uses the "randomize [seed value]" command to encrypt files. You have to provide the correct value to get the correct random numbers to decrypt a file. Maybe that helps.

Smile and be happy, things could be worse!
So I smiled and was happy, and things got worse...
Easily Confused
23
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 24th Mar 2003 23:53 Edited at: 24th Mar 2003 23:54
There is a problem with this "random encrytion" method however, any upgrade to DB that changes the way random numbers are generated will make this fail to decrypt files already encrypted beforehand.

I know, I tried a similar trick in VB 6.0 which was then upgraded then my program worked differently from before.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 25th Mar 2003 00:11
erm... there is BIG difference between encryption and compression
my example is a simple 8bit encryption - as it only encrypts every 8bit of data, that is also probably the simplest form of it you can get...

something like 128Bit SSL Microsoft encryption would be WAYY over most people heads here, because you take every 32bit dword and you then run an runtime algorithm against it but you have 4 algorithms per 128bit (which is why its each 32bit) and then you run a 5th one on the whole 128bit by swapping the byte values of every Nth number of bits in the byte.

i'd require a minimum of 280lines of code in DBpro and wouldn't be a worthy example (^_^)

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
solo
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Israel
Posted: 25th Mar 2003 00:42
There is a simple encryption method using XOR ( ~~ in DBPro):

choose a numeric password, such as: password=456778655
now, lets say you have the data: x=123456789

use the XOR operator with your password on that data:
x=x~~password

now, if you print x, the output will be:
476196490

we all agree that the output it totally different from x and from password.
This is an encrypted data. well, how to convert it back?

Just use the same password to XOR it again:
x=x~~password

Now, print x and you get again the old data:
123456789

You can XOR your data to a file with any numeric password,
then read it back with the same XOR + password.

[solo]

solo
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Israel
Posted: 25th Mar 2003 00:48
ofcourse, you can't write/read the file in one piece,
you should break your data to pieces and use this method in a loop
for each piece.

[solo]

the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 25th Mar 2003 00:55
What about some sort of checksum. Put the checksum in the file and then run the checksum generator in your game on the map info loaded from the file and check that it matches the checksum in the file.

GuySavoie
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 25th Mar 2003 02:02
You could store your data in a password protected ZIP file and use the RGT•ZIPtools to access it. Encryption and compression.

DangYankee
23
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 25th Mar 2003 02:59
That's what I was trying to hint at but got a smirk about the difference of compression and encryption .

It's not the size of your code but how efficiently you use it!

Login to post a reply

Server time is: 2026-07-11 03:37:43
Your offset time is: 2026-07-11 03:37:43