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 / How is HexToBase64 used?

Author
Message
traumvogel
11
Years of Service
User Offline
Joined: 2nd Jul 2013
Location:
Posted: 19th Jan 2018 23:07
Can someone give an example for using this function?
I know that the input must be a hex encoded string: How is this input interpreted? Always two hex characters interpreted as one byte?

I want to xor encrypt a string with a key. Problem is that if a character of the string to be encrypted is the same character as the current character from the key being used the resulting code is 0 and this cannot be put into the result encoded string because this is automatically interpreted as end of the resulting encoded string even if it should be continued with more data. Does someone understand what I mean?

puzzler2018
User Banned
Posted: 19th Jan 2018 23:17 Edited at: 19th Jan 2018 23:18
XOR -
11001100
= 00110011

Inverts the binary diits
puzzler2018
User Banned
Posted: 19th Jan 2018 23:32
so encrypting with a key like decimal 129 which is ultimately binary 1000001

XOR 129 with any character there after

ASC(32) = 00100000
XOR with
128 = 10000001
= 10100001

Keeps the 1's in the binary code where there is only 1 in either two of the binary
If both are any 1s in the two would result in 0

ASC(130) = 1000010
XOR with
127 = 1000001
= 0000011

Still mind boggled !

https://en.wikipedia.org/wiki/Bitwise_operation


traumvogel
11
Years of Service
User Offline
Joined: 2nd Jul 2013
Location:
Posted: 19th Jan 2018 23:53
Thanks! In the meantime I found out. HexToBase64 takes pairs of hex characters.
My encryption function now looks like this:



Works as intended.
puzzler2018
User Banned
Posted: 19th Jan 2018 23:56
That will work

Great stuff

ps. dont use the same key through any encryption - can be hacked with seconds
traumvogel
11
Years of Service
User Offline
Joined: 2nd Jul 2013
Location:
Posted: 20th Jan 2018 18:28
I know this solution is weak. I use it to transport passwords for user authentication using the AppGameKit multiuser networking functions from client to server. Currently it is only a little chat app experiment. But there has to be user authentication and it is really a pity that the AppGameKit multiuser net functions do not use SSL... Maybe there will be some better encryption possibilities in the future?
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 22nd Jan 2018 08:49 Edited at: 23rd Jan 2018 12:17
traumvogel, please show your decryption function. Thx!

What does this symbol do?
https://www.instagram.com/qugurun/
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jan 2018 13:49
mid will return a substring of input$ starting at Nth position and contain a length of only 1 character. ASC will then convert that string character into its integer ASCII value (see http://www.asciitable.com/).

The second line does the same thing just with different values. And the double tildes (squiggles) is the bitwise XOR operation.
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
traumvogel
11
Years of Service
User Offline
Joined: 2nd Jul 2013
Location:
Posted: 27th Jan 2018 00:24
The decryption function I implemented not in AppGameKit but in PHP. Rather easy there:



I have no decryption function available in AGK. I am not sure how to implement it. The problem is the non-existance of binary strings like in PHP, that is a AppGameKit string cannot contain a zero "0" character.

But what I would like much more is a more secure encryption function. XOR is way too weak...

Login to post a reply

Server time is: 2024-11-24 03:43:03
Your offset time is: 2024-11-24 03:43:03