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.

AppGameKit Classic Chat / Encryption and Decryption

Author
Message
puzzler2018
User Banned
Posted: 18th Nov 2018 23:22 Edited at: 18th Nov 2018 23:24
Thought to make this seperate - this is not memblock work

Asset encryption code

Encryption code


Decryption



Ill leave it from the memblock work thread cause its not really memblock work

Hope you find it useful, I know i will
puzzler2018
User Banned
Posted: 25th Nov 2018 14:07 Edited at: 25th Nov 2018 14:07
I have implemented an individual asset enc/decrypter to help the thousands of asset version - just removed a while loop out of it lol



Decrption



You will have to try with some assets though





Enjoy
puzzler2018
User Banned
Posted: 4th Dec 2018 20:28 Edited at: 4th Dec 2018 20:36
After Rockman Revisited,

Im going to have a bash at compressing an OBJ file, as such

v 19/20/10
v 19/20/10
v 19/20/10
v 19/20/10

vn 19/20/10
vn 19/20/10
vn 19/20/10
vn 19/20/10

f 19/20/10
f 19/20/10
f 19/20/10
f 19/20/10


This is 100 bytes.. We can compress this by removing the /s (Slashes) and changing the 19, 20 and 10 to single Bytes and then merging two consequtive characters together

Like this

v 123123123123
vn 123123123123
f 123123123123

= 43 bytes

Merging two characters

v 1111111
vn 111111
f 111111

= 30 bytes

The 123 is my way of saying they are bytes = so 19, 20 and 10 are the asci codes to save a byte to a file with

plus removing all the lines that start with # (REMs) too and white spaces.

100 bytes to 43 is a huge dramitic disk saving

All goooooood!!!
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 7th Dec 2018 00:53
Compress an Obj file first by reducing the precision. This takes off quite a bit before you even start.
e.g. 19.9182737 can round down to 19.918 without any problems.
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 7th Dec 2018 12:53 Edited at: 8th Dec 2018 03:26
puzzler2018,

Now I only took a quick look at the encode/decode routines, but i'm surprised your storing the key inside the file. Which appears to mean that anyone can decode files, ideally the key would be kept / generated outside of the files, which will save file space & reduce read/write overhead.


Anyway, since the performance of such function comes down to how many opcodes are executed through the A.G.K V.M per BYTE, small tweaks in logic can make big differences in actual execution performance.

Starting example,



The expression If encloseY> Size can be folded inside the X comparison since encloseY doesn't change unless the X cord overflows , saving a compare and branch every byte processed




Rather than store the key as a 2D array, you could just store as 1D array . This means you only have one offset to manage and it's cheaper on the runtime when accessing the array.




ideally you could unroll the processing into chunks, a little more code.. but the cost per byte is way lower




You can opt out the read / write bytes by moving to the bigger data type such as 32bits at a time, making it easier for optical drives and reducing the Vm overhead to a 1/4 of what it is now. Ideally it's often better to read your source file in to a temp buffer first, then do your processing and dump from that. This greatly reduces the head thrashing when read/writing files.



erm.. I Shouldn't post and watch youtube at the same time

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
puzzler2018
User Banned
Posted: 7th Dec 2018 23:56
Thanks for that info. will have to make things little stronger

We all have an idea im sure how it works at least

Too many projects going on... Ouch...

puzzler2018
User Banned
Posted: 12th Dec 2018 20:36
Encryption key outside the App of AppGameKit can be tedius depending on platform we run games on

Windows - where do we save the key file

Andoid - where do we save the key file

etc
etc

So many variables here.

So how about we create an encryption key based upon the values that come from

GetDeviceBaseName
GetDeivceID
GetDeviceIP
GetDeviceName

concatinate all the strings from the above and use that!!!

This file then gets added to the AGM file, so no matter what, if we play apps on a device other than the above GetDevice??? then say this is not installed on the right machine, plasee re-install the app.

Perfectly do - able
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 13th Dec 2018 02:10
Quote: "Encryption key outside the App of AppGameKit can be tedius depending on platform we run games on"


Perhaps still use the encrypted media file in the package but add another form of calculation to it ie rot 13 that
takes the value stored in the image and passes it to the rot 13 encryption algorithm which could be embedded
into your code. That way even if they know the image is the key they wont know the second key.;

It doesn't have to be rot 13 but could be some other algorythm
fubar
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 16th Dec 2018 17:41
Quote: " Encryption key outside the App of AppGameKit can be tedius depending on platform we run games on
"


The Key is stored, well generated within the App. The 'builder' runs through and encodes the files and spits out a file that the end user includes in their project.

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code

Login to post a reply

Server time is: 2024-03-28 16:38:54
Your offset time is: 2024-03-28 16:38:54