Encrypting Data

Hai all,

I’m trying to go about encrypting data and putting it in a .txt file in /data/ and then somehow read it.

For example; in the file “data/msc/nor.txt” I have a string such as “ohhaiistoleurcompoter”. This isn’t the real MySQL password but instead can be decrypted in Lua with some sort of function combination to retrieve the password.

Is it best just using string.gsub or is there some other way of doing it?

Thanks for any replies,

Why store it in /data. You can just keep it in your gamemode, just don’t let people you don’t know access your server.

Yes but in case it is ever ripped, or “hacked” as such… There needs to be some form of encryption. I suggested /data/ because if the ‘hacker’ fails enough to just rip the gamemode/ then technically the encrypted password wont go with it.

Thanks for the suggestion, however.

Just manually store it in /data then, no point in encrypting it. You’ll have to have a file.Read line somewhere. Then again, you could just set your MySQL server to only accept local connections.

Yes but if they were to download that specific data file then they’d have access to a database. Plus you cannot set MySQL to local as it wouldn’t be local to the server.

You could use a module to encrypt it with a password. Other than that, I don’t think there is a way, unless you write your own lua encryption which will then just be read and used.

Its easier to get files out of the data folder than gamemode.

Thanks, I suppose it’s custom encryption then, thanks to all (but if there’s any more suggestions then go ahead).

How about just storing it in the server’s database with sqlite?

Good idea. Is there anyway to open up SQLite in the extreme case that it was downloaded somehow? Even so you could encode it in that database too, with some database string that made it seem like it was integrated in.

For example a server_players database, with steamid as something that looks right but is frankly impossible and the server password as the name?

Jolly good idea sir, thanks a lot.

Use the SHA/MD5 Modules

If you can access the server.db file then yes, you can easilly open it and read it’s content. The thing is if someone managed to do that then they already have access to all of your files don’t they? So they’ll be able to get the lua files and see how you encrpyted your data, unless I’m missing something.

True, good point.

I’ll just go with the server.db thing then, it sounds like the most reasonable way. I doubt anyone would be up for hacking any servers that I’m a part of anyway, hurhur.

Thanks again for all your suggestions.