Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Security Login using GravityScore's SHA-2 Encryption
- Security Login - by LegoStax
- ]]--
- os.pullEvent = os.pullEventRaw
- -- Load Login Image
- bg = paintutils.loadImage(".programs/login_img")
- paintutils.drawImage(bg, 1, 1)
- -- Load Grav's SHA
- os.loadAPI(".programs/sha")
- -- check for user info
- if fs.exists(".programs/user") then
- -- get table
- info = {
- cpass = nil;
- user = nil;
- }
- local file = fs.open(".programs/user", "r")
- info = textutils.unserialize(file.readAll())
- file.close()
- end
- -- Check Textboxes Function
- function checkPass(user, msg)
- checkpass = sha.sha256(msg)
- if user == info.user and checkpass == info.cpass then
- shell.run("lithos")
- else
- paintutils.drawImage(bg, 1, 1)
- end
- end
- -- Main
- term.setBackgroundColor(colors.lightGray)
- while true do
- term.setCursorPos(14,12)
- write ""
- user = read()
- term.setCursorPos(14,17)
- write ""
- pass = read("*")
- checkPass(user, pass)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement