Jump to content
naught

Encryption in SQF - SQF Crypt Script

Recommended Posts

SQF Crypt Script

Version 1.0

By Naught

Download: http://pastebin.com/iH1uF3Vh (all of the documentation is included in the file)


Hello all!

So I've been playing around with binary in SQF, and I've managed to develop a really neat encryption script completely in SQF.

Currently it only employs the RC4 stream encryption algorithm, but can be fitted to support more.

It's full encryption, just as you would get as if you were coding in C! But it's only currently running at 6 kB/s in the unscheduled environment.

Note: Encryption may not produce the same values as another program might, as all 0 values in the encrypted text are converted to the value 256, as SQF counts values of 0 as null-terminations of strings.


Example

#define CRYPT_KEY "my_secret_key"

private ["_text"];
_text = "Hello World!";

hint _text; // Outputs "Hello World!"

_text = [1, "rc4", _text, CRYPT_KEY] call ALiVE_fnc_crypt;

hint _text; // Outputs "ïÇ(RÃ"NdØ}O"

_text = [0, "rc4", _text, CRYPT_KEY] call ALiVE_fnc_crypt;

hint _text; // Outputs "Hello World!"

Edited by Naught
  • Like 1

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Wow, that's amazing! Not sure if it's of any use for me but still - impressive work!

But thinking about it, that could offer some interesting mission scenarios. Provided we use small enough keys / plain text even brute force attempts should be feasible during a mission. Encrypting enemy intel, cracking laptop passwords, accessing enemy drones - it certainly fits the 2035 scenario.

Share this post


Link to post
Share on other sites

I initially thought this was for encrypting a chunk of code, so no one could steal it, but reading IndeedPete's post this has piqued my interest. Code breaking within the game would add another interesting layer of complexity for players. Bravo!

Share this post


Link to post
Share on other sites

Well, you could actually encrypt your .sqf source files and decrypt them right before compiling. But it doesn't make much sense since the key itself is written in plain text. oO

Share this post


Link to post
Share on other sites
Well, you could actually encrypt your .sqf source files and decrypt them right before compiling. But it doesn't make much sense since the key itself is written in plain text. oO

The key can be stored only server-side, where server admins would need to register or do something of the sort to get access.

Or even better, you could encrypt data on clients and only decrypt it with the server, or create a system similar to how SSL/TLS works (which actually can use the same RC4 algorithm) to help eliminate hacking. Or you can pull a key from a server with a remote address on htmlLoad, which I think works (it's written in ALiVE to do that for the news feed, but I haven't actually tried it)...

But anyways I love your idea about using it in-game to add a cyber element to the mix! I didn't even think of that.

  • Like 1

Share this post


Link to post
Share on other sites

And I didn't think of multiplayer with server stuff. Total single player here.^^

True, if you handle the decryption / key generation server side it could actually make sense to encrypt the code. I have no idea how people can cheat / hack in Arma 3 MP but if encryption prevents some attempts, why not?

Of course, in SP you could simply simulate a "fake-hollywood"-encryption by creating a fancy dialog with pre-set plain text / cypher text and some kind of (math) riddle to solve. But why not use a real encryption if it's possible? I find this idea interesting and I'm looking for some fitting scenario to add this to one of the future missions for my M.E.R.C.S. campaign. I'll get back to you when I have a concrete idea, just for MANW license reasons.

Share this post


Link to post
Share on other sites

If you really don't want people to get a hold on your scripts, you can just store all your scripts on the server and read them as text to send to the clients in public variables to compile. You will only then need to have the init.sqf, hpp files, audio and images in your client pbo.

Share this post


Link to post
Share on other sites

hi,
Thank you for your work, I was just looking to write it myself, to work very well for our mission.

  I adapted them to a GUI menu (without modification of your source file), if you allow me and if some are interested, I could share my work here;)

 

mini_842070107410screenshots201801072259

 

mini_966027107410screenshots201801072259

Share this post


Link to post
Share on other sites

Thank you for your work , but there is a little problem in installation progress , can you explain how we gonna install this where we should paste those code ?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×