This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
anonimo182's profile picture

[QUESTION] [LUA] Need encryption forms

Started by anonimo182, 10 October 2012 - 04:31 PM
anonimo182 #1
Posted 10 October 2012 - 06:31 PM
Does anybody knows a form to encrypt that is reliable and secure?

Thanks
jag #2
Posted 10 October 2012 - 07:19 PM
Look up the "string" function/api on the webz.
For example this one
http://lua-users.org...LibraryTutorial
(Got it from google'ing lua string)

EDIT: Ignore this ⇈, I was being derpy. As a real answer; there is no built in way to encrypt.
But you can always download others like → this ← one.
Or see a list of a lot of them → here ←.
anonimo182 #3
Posted 10 October 2012 - 07:35 PM
Thanks!
jag #4
Posted 10 October 2012 - 07:48 PM
All trough, the best way of storing your password/username is to save the content/info in a file
Spoiler
function checkPass(pass)
    local content = ""
    if not fs.exists(".passwords") then
        return false
    end
    if not pass then
        error("Needs an input!")
    end
    file = fs.open(".passwords", "r")
    content = file.readLine()
    while content ~= nil do
        if content == pass then
            file.close()
            return true
        end
        content = file.readLine()
    end
    file.close()
    return false
end

function makePass(pass)
    if not fs.exists(".passwords") then
        return false
    end
    if not pass then
        error("Needs an input!")
    end
    file = fs.open(".passwords", "a")
    file.write(pass.."n")
    file.close()
    return true
end
And then just call the functions to do what you want.
anonimo182 #5
Posted 10 October 2012 - 10:54 PM
That was I did, but I needed any form to encrypt that file, so only through a special decryption it can be readable, specially to prevent hackers