string.gsub(s, a, "01100001") string.gsub(s, b, "01100010") string.gsub(s, c, "01100011") string.gsub(s, d, "01100100")I have been looking around, and the only thing I found anything to is a mention of the Bit API.
string to binary (and back)
#1
Posted 08 April 2014 - 01:40 AM
#2
Posted 08 April 2014 - 01:46 AM
#3
Posted 08 April 2014 - 01:47 AM
theoriginalbit, on 08 April 2014 - 01:46 AM, said:
Edit: possibly used with a function like this:
function getPass()
local pFile = io.open("pass", "r")
return pFile:read()
pFile:close()
end
Edited by KingofGamesYami, 08 April 2014 - 09:02 PM.
#4
Posted 09 April 2014 - 03:36 AM
I want to convert a string (eg. password) into a binary number, which I will then use some sort of equation on to make a number. That number will be saved to a file, and that file will be read when the login refers to a password. Each password is customised to its own file, which are going to be saved as the username's binary sequence. I hope to make it as hard as possible for a human to decode what the passwords are.
edit: by username & login i mean the user supplies a username, when the computer asks for a username and password, it will save the (correct) data as a local variable, stored as "SessionID".
Edited by KingofGamesYami, 09 April 2014 - 03:38 AM.
#5
Posted 09 April 2014 - 03:41 AM
You're better to use hashing for this. it is far more secure, there is no way for a user or program to read the hash and know the password. just search the forums for SHA256 and you'll find a couple of implementations. then when you want to check the user input against the hashed password, just hash their input, if their input was the correct password the two hashes will match.
There are other advantages to hashing passwords which you could also find with a simple search on these forums, I've typed out the advantages many a time, and don't really have to time to now.
Edited by theoriginalbit, 09 April 2014 - 03:43 AM.
#6
Posted 11 April 2014 - 02:24 AM
KingofGamesYami, on 08 April 2014 - 01:47 AM, said:
Edit: possibly used with a function like this:
function getPass()
local pFile = io.open("pass", "r")
return pFile:read()
pFile:close()
end
#7
Posted 11 April 2014 - 02:45 AM
Dog, on 11 April 2014 - 02:24 AM, said:
KingofGamesYami, on 08 April 2014 - 01:47 AM, said:
Edit: possibly used with a function like this:
function getPass()
local pFile = io.open("pass", "r")
return pFile:read()
pFile:close()
end
local function getPass()
local h = fs.open('pass', 'r')
return h.readAll(), h.close()
end
#9
Posted 11 April 2014 - 03:08 AM
Dog, on 11 April 2014 - 02:54 AM, said:
local function doStuff() return "hello", "world" end local foo, bar = doStuff()however the close function doesn't return anything, so in the case of reading all and closing the file, you'd only get one return value; the file contents.
Edited by theoriginalbit, 11 April 2014 - 03:09 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











