Reading binary files with notepad?
Posted: Wed Jan 29, 2014 12:48 pm
I'm at a point where I need a certain Lua file to not be very easily accessible. Why you might ask?
My Setup
I have a login system set up on a server. All my Lua code does is make an http request to a php file, sending a username and password, and the server tells me if they are correct. Since authentication and everything is handled on the server, everything should be secure client-side.
The Problem
Now I want to store the username and password for convenience, so the user doesn't have to enter them every time they open my game/launcher. However, I don't want to just store them as plain text. I thought I could simply hash or encrypt them in some way, but no matter what I do, as long as the person can read the code, he can figure out how to decrypt it really easily.
So I thought to compile just the encryption/decryption function into binary, with string.dump, and then run it with dofile and such. And I was happy to see this is what the file looks like when you open it in sublime
Now to my horror, when I try opening it with notepad, I get:
The code's just..there, with a bunch of extra jumbled stuff. This is the original file I was testing with:
How is it so easy to just..see the code?
When I try the same thing with LuaC, it only shows the function names in notepad. But the binary code from LuaC isn't compatible with LuaJIT's.
So the question
Are there any tricks to just make it harder for someone to steal the user and password even if you know where they are stored on the computer? It's just an added level of security.
Thanks in advance for your time!
My Setup
I have a login system set up on a server. All my Lua code does is make an http request to a php file, sending a username and password, and the server tells me if they are correct. Since authentication and everything is handled on the server, everything should be secure client-side.
The Problem
Now I want to store the username and password for convenience, so the user doesn't have to enter them every time they open my game/launcher. However, I don't want to just store them as plain text. I thought I could simply hash or encrypt them in some way, but no matter what I do, as long as the person can read the code, he can figure out how to decrypt it really easily.
So I thought to compile just the encryption/decryption function into binary, with string.dump, and then run it with dofile and such. And I was happy to see this is what the file looks like when you open it in sublime
Now to my horror, when I try opening it with notepad, I get:
The code's just..there, with a bunch of extra jumbled stuff. This is the original file I was testing with:
Code: Select all
local Encrypt = {};
function Encrypt:Lock(user,pass)
print('a')
end
function Encrypt:Unlock()
--return user and pass
end
return Encrypt;
When I try the same thing with LuaC, it only shows the function names in notepad. But the binary code from LuaC isn't compatible with LuaJIT's.
So the question
Are there any tricks to just make it harder for someone to steal the user and password even if you know where they are stored on the computer? It's just an added level of security.
Thanks in advance for your time!