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 / [code] txt to chr (hide string in bycode) or Agk to txt (export code for agk)

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 7th Nov 2023 08:07 Edited at: 10th Nov 2023 08:28
Hi

Here is a little code to hide string in your code or to get txt$ from an agk code.

The full code (with functions) :



How to use this code ?


1) txt to chr :

How to use it ?

For exemple, if in your code, you have string that you want to hide in the bytecode :


you can use this tool to get chr() or chr[] (if you use a global dim chr[]) to hide your code.
After convert it ith this tool, you will get :


I use that to get the code to hide my string in the bycode of my games/appl .




2) how to use Agk2txt :

If you want to create an appli or game which will export some agk code, you could have to write all the exported code by hand.
With agk2txt, if you have this code to export :


You can use the buton agk2txt and you will get :


And how to use it in you code ?

simply :



I use that to get the code to export for agk, from my app

I hope this can be usefull
cheers
AGK2 tier1 - http://www.dracaena-studio.com
Aidan
User Banned
Posted: 7th Nov 2023 17:22 Edited at: 7th Nov 2023 17:56
I'm sure this would be useful for many applications, especially if writing a full document which includes line breaks and linefeeds to string.

It's how AppGameKit shader code is built internally to send to the GPU.

Good idea and thanks for sharing.

Double quotes for example always to get me into a fully formatted string properly especially when used to write webpage code always gets me everytime.

Thanks anyway and will be useful

Edit... In the bytecode, always stores readable strings in it so this is great idea to construct the strings via chr()s instead of the readable strings. Stops hackers identifying what the app is doing.

Great concept,

To stop people from using hex apps to rewrite the bytecode where the readable strings are, to store all the readable strings in an encrypted file in the app then read in the encrypted and decrypt on game loads.

Or am I over thinking the idea .

If hackers can tweak the bytecode after compilation then they can what we call "mod" the applications and redistribute themselves

For example if they see a string "written by blenderman"
They can change to "written by Joe bloggs"

Have I opened up a full can of worms here, if an app is good enough then it could happen, I do NOT advise any of us doing this,(this is against the rules) but it is acheivable to any that wants to, unless AGk as sorted this out - I have always been fond of protecting our media and internal wordings we have in our apps.

Just an additional thought

This concept is greatly appreciated


Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 10th Nov 2023 08:30 Edited at: 10th Nov 2023 08:30
Hi

Thank you, but I have forgotten to post the full code with the functions txt2chr() and agk2txt() ^^

Sorry

I ha ve edited the first message and added the full code to get the code txt2 chr and agk2txt
AGK2 tier1 - http://www.dracaena-studio.com
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 13th Nov 2023 05:08 Edited at: 13th Nov 2023 05:12
txt to chr is clever and useful, blendman.

i saw it inside some of your code from another recent thread of yours and have been using it since as it's clever and necessary.

meanwhile, i'd meant to post this clean snippet sooner but you beat me to it with this thread.

regardless, thanks for sharing as you always do
GemGames
5
Years of Service
User Offline
Joined: 31st May 2018
Location: Edmonton, Alberta, Canada
Posted: 14th Nov 2023 00:40
Thanks for the code listings and for sharing the concept of obfuscating text strings as a safeguard against hackers/pirates. Much appreciated, that is something I hadn't really thought of doing with AppGameKit until I read your post in this thread.
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 14th Nov 2023 13:30 Edited at: 14th Nov 2023 13:50
Quote: "
Name$ = Chr[82]+Chr[111]+Chr[98]+Chr[101]+Chr[114]+Chr[116]
"


While this obviously doesn't impact AGK/S today; it's worth noting that if they add pre-evaluation of the literal expressions; then the compiler would evaluate the expression at compile time and insert the literal string in place of the expression in the output code.

Making the code that actually goes to compilation Name$ = "Robert"


You could use an array ; so the creator code spits out a bit of code like this and your just cut'n'paste em in (psuedo code)

dim NameCHRS [ 6 ] as integer = [ 82,11,98,101,114,116 ]

Name$ = GetString(NameCHRS[]);

The function runs through the passed array and concatenates the fragments back together.

But it potentially suffers from same problem; what if the compiler picks up the list of values are bytes and dumps them out sequentially ? ; the string would be visible to in the output code. Even if doesn't and they're still visible as words or longs .

Ideally it'd be better to apply some transform function to the input string and then provide a reverse function to the user. One easy way is to mult the character codes by some constant; then reverse the process to convert data back to a string.

Here's a PB example; but the point is when generating the hidden text we apply some math operations to it; and then we reserved them to convert the mangled text into something readable.




Example Output:

803,2266,3663,4928,6380,2508,7238,10472,12177,12980,13431,
Hello World

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 15th Nov 2023 09:53
Hi

Thank you for your answer

@Kevin Picone :
I have adapted your code for AppGameKit


AGK2 tier1 - http://www.dracaena-studio.com
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Nov 2023 13:46
I'd recommend anyone using my purpletoken service to use this to secure their private game key.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-04-28 12:22:57
Your offset time is: 2024-04-28 12:22:57