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 / string math.

Author
Message
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 19th Jun 2019 07:08
I think the commands exist in agk to do what i want but im not sure on the correct procedure. tried it a couple times with no success. i could do it with an array but i feel its not the easiest or proper way to do it. Id like to take a string like hello turn it into ascii add 100 for example or an algorithm then subtract 100 and turn it back into a string as a form of simple encryption for sending data.
ive tried to do send=asc("hello")+100 val(send-100) and many permutations but no luck. not sure if theres a simple way to do it or not or if i have to read each bite and run it against the ascii chart and return it char by char. thank you for your time
A child's dream never dies.





fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 19th Jun 2019 07:35
do you mean the rot 13 algorithm
because you could just use a value of each letter and do something like the following
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 19th Jun 2019 19:25
that function you post it doesn't actually do anything as is. but yes I'm using it to create a cipher. currently each player has one socket connection to my server and I would like to create a cipher an algorithm that changes based on the date and time on Client server as a form of encryption just to make it hard for players I want to try to use chat injection or and external program that can build and send packets with false data
A child's dream never dies.





fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 19th Jun 2019 20:13 Edited at: 19th Jun 2019 20:15
Quote: "that function you post it doesn't actually do anything as is"

you pass it a ascii value, the code value and the range to restrict it within printable characters
thats exactly how ROT13 works

you can see it working here https://forum.thegamecreators.com/thread/222027
where two types of algorythms are combined including ROT13 for media encryption

Quote: "Like with all things keep a copy of your originals un touched somewhere safe"
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 20th Jun 2019 02:06 Edited at: 20th Jun 2019 02:16
not exactly what im looking for but gives me some ideas. ty similiar to what i want to do but far to simple and a known process.
A child's dream never dies.





fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Jun 2019 02:20 Edited at: 20th Jun 2019 02:22
the mod isn't used in the above but Mod returns the remainder of the division it was how it worked nicer in c with %
the formula works like
c = cipher(asciiKey,rot13Key,256)

asciiKey the key you want to encode
rot13Key the value to add to the asci key IE a+2 would make that key c
256 is the value i used in the above example to restrict it to a printable range but could easily be 128 etc
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Jun 2019 02:26
the original was converted from c++ code I had which you could restrict it between a and Z and the formula
used mod to do this I just couldn't get it to work proper with mod the way it did in c. The c version allowed
any value to be added and it always worked but the above method might work for 13 as the key but not for
some value like 150 as I didn't get the restrict to printable range bit working perfect like it did in c
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 20th Jun 2019 02:38
Thats pretty cool for a fast n quick encryption. Im trying to build all in one socket server for the tgc community so anyone who wants to make a mulitplayer game just has to include and use a few simple commands to get started. should work on any platform or web plus agc has a broken command that makes it hard for a beginner to program multiplayer. But i think im going to need a lot more encrytion then that in the event someone does get a bit game going they dont have issues because of my oversight. but u told me all i needed yo know really. character by character using ascii. i was trying yo convert my whole string at onc i think.
A child's dream never dies.





smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 20th Jun 2019 19:51
think ill end up using a substitution method after all run into to many problems with converting strings into base 16 only works on small nums. then have to chop every word into tiny pieces and trying to glue everything back together to much headache i think.
A child's dream never dies.





Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jun 2019 20:12
You can't just simply add a decimal onto a string of ascii values. You can convert a single ascii character to a number but not really an entire string. The closest thing to what you want (and easiest) is the ROT13 method already mentioned. It is a substitution method.

You can use my library for converting Base64, but that's a method for transmitting data in a textual format, not for encryption purposes. You can do a very simple symmetric cipher by using XOR.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"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-11-22 21:58:45
Your offset time is: 2024-11-22 21:58:45