• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML AES Encryption

L

Lintydude

Guest
Hello people, I had been looking around on the forums for an AES implementation in gml, but I haven't found anything about it so far. If anyone has made an implementation of this in gamemaker, I would be very grateful if you shared it. I don't have the knowledge/capabilities to convert c++ to gml, which is why I'm asking for help
 

Tthecreator

Your Creator!
So you just want to convert a string to another string using AES?
I don't think there really is a way in gamemaker. However, as you already stated, c++ could do it. There is probably a very simple library AES out there, that you could just utilise trough a DLL. It shouldn't be very complicated I hope. Btw have you looked at the marketplace? Also this wikipedia article gives a decent insight in how AES works: https://en.m.wikipedia.org/wiki/Advanced_Encryption_Standard
 
R

rui.rosario

Guest
You can fairly easily port C++ code to GML within a reasonable margin of error (basically it depends exactly on how many features of C++ that do not exist in GML are used, and how many work arounds you're willing to use). However, when it comes to cryptography, I highly recommend that you never attempt to port the code to GML or implement it yourself because a simple mistake can introduce security holes in your encryption. Hence, if you find a DLL (trustworthy) I recommend you use it.

This of course does not apply if you're trying to devise your own cryptographic method, although you still need to be really careful about security holes.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You can fairly easily port C++ code to GML within a reasonable margin of error (basically it depends exactly on how many features of C++ that do not exist in GML are used, and how many work arounds you're willing to use). However, when it comes to cryptography, I highly recommend that you never attempt to port the code to GML or implement it yourself because a simple mistake can introduce security holes in your encryption.
With cryptography, compression, and file formats, introducing errors usually means that the algorithm will simply cease to work and you'll have some damn jolly time debugging the thing. Perhaps the only category that can be ported with errors while still functioning is hashing algorithms (due to nature).

Also to not forget about language-specific quirks - for example, GML implicitly converts between 32-bit and 64-bit integers where needed, which means that things will get strange if the original code relies on manipulation of sign bit in the numbers.
 
R

rui.rosario

Guest
With cryptography, compression, and file formats, introducing errors usually means that the algorithm will simply cease to work and you'll have some damn jolly time debugging the thing. Perhaps the only category that can be ported with errors while still functioning is hashing algorithms (due to nature).

Also to not forget about language-specific quirks - for example, GML implicitly converts between 32-bit and 64-bit integers where needed, which means that things will get strange if the original code relies on manipulation of sign bit in the numbers.
Exactly, that's why I stated the features not existent in GML and such.
Even hashing will suffer from it, since you may introduce a higher rate of collisions than the original algorithm had (depending on the error it may even prove itself completely unusable).
 

zbox

Member
GMC Elder
eh I'll do a full GML implementation in the next few days if noone else gets to it first

dunno if speed will be amazing tho
 
L

Lintydude

Guest
First of all, thank you for all of your replies. I really appreciate it.
 
L

Lintydude

Guest
Exactly, that's why I stated the features not existent in GML and such.
Even hashing will suffer from it, since you may introduce a higher rate of collisions than the original algorithm had (depending on the error it may even prove itself completely unusable).
I did manage to find a sha512 hash script made in GML that had no errors
eh I'll do a full GML implementation in the next few days if noone else gets to it first

dunno if speed will be amazing tho
This would be awesome man, can't wait :D
There is probably a very simple library AES out there, that you could just utilise trough a DLL. It shouldn't be very complicated I hope.
Oh yeah, I forgot about that ._. however, DLLs in Gamemaker for me is not easy. But if someone were to link some good tutorials, that would be much appreciated :D
 

zbox

Member
GMC Elder
OK all done - can encrypt binary files or straight out strings. Encrypts at about 8.5kb/s on my decent computer (further performance updates pending in the future if enough people utilize it, it's not very fast in comparison to Crypto C++ for example), but if people want it for quick cross platform use then great.

I spent quite a while making sure it all worked ok and performed adequately so I'll probably put a few bucks on it on MP... @ OP shoot me a message and I'll send you a free copy
 
Last edited:
Top