Posted 30 January 2015 - 03:39 PM
Ok, so I've tried to make a security startup, which is impossible to get any password out of, so I found sha256, and tried it, tried to make it into my code. But I keep on getting errors, can someone help me? Thanks in advance.
-- Setup
os.loadAPI("sha")
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.cyan)
os.pullEvent = os.pullEventRaw
-- Define
-- Main code
textutils.slowPrint("Eyax Security", 1500)
sleep(1)
term.clear()
term.setCursorPos(1,1)
while true do
textutils.slowPrint("Login / Shutdown / Reboot")
print(" ")
term.setCursorPos(1,3)
print("|--------------|")
term.setCursorPos(1,5)
term.setCursorPos(1,4)
print("|")
term.setCursorPos(16,4)
print("|")
term.setCursorPos(1,5)
print("|--------------|")
term.setCursorPos(4,4)
input = string.upper( read() )
if input == "LOGIN" then
print(" ")
term.setCursorPos(1,7)
print("Please input username to login.")
write("Username: ")
username = read()
print(" ")
print("Please input password to login.")
write("Password: ")
password = read("*")
if username == "EyaxJonas88" and sha.sha(password) == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" then
print(" ")
term.setTextColor(colors.lime)
print("Access Granted.")
sleep(1)
term.setTextColor(colors.yellow)
term.clear()
term.setCursorPos(1,1)
write("Eyax --")
break
else
print("Username or password is invalid.")
sleep(1.7)
term.clear()
term.setCursorPos(1,1)
end
elseif input == "SHUTDOWN" then
print("Shutting Down...")
sleep(1)
os.shutdown()
elseif input == "REBOOT" then
print("Rebooting...")
sleep(1)
os.reboot()
end
end
Edited on 30 January 2015 - 04:09 PM