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

Login 1.2 - by Rednet Works

Started by KronixGames, 17 August 2012 - 04:37 AM
KronixGames #1
Posted 17 August 2012 - 06:37 AM
hello people, sorry for my bad English, is that I am Brazilian, so lets get to the point, today I am here to announce the first new program "Rednet Works", in which case I created, I made the Login 1.2, this program you put your computer to the security of the CC 1.41, remember to first create a file named "pass" without the quotes.


For the next version:
* Auto-creation of the file 'pass'
* Login fastest
* Fewer lines of script

And ciba43,thank you for have the idea of auto creation of the 'pass' file.

pastebin get iCMHgAjt to get in-game

startup:


function c()
  term.clear()
  term.setCursorPos(1, 1)
end
function new()
  c()
  print("You do not have a password")
  write ("Enter a new password: ")
  pass = read()
  write("Confirm the password: ")
  com = read()
  if com == pass then
  print("You have one new password")
  local f = fs.open("pass", "w")
  f.writeLine(com)
  f.close()
  else
  print("Passwords must equal")
  end
end

function pw()
  c()
  local f = fs.open("pass", "r")
  write("Enter the password: ")
  pass = f.readLine()
  if read("*") == pass then
  print("Welcome user!")
  else
  print("Please, enter a correct password")
  sleep(1)
  pw()
  end
  f.close()
end
function verify()
  c()
  local f = fs.open("pass", "r")
  line = f.readLine()
  if line == "" then
  new()
  else
  pw()
  end
  f.close()
end

verify()
Edited on 09 January 2013 - 09:52 PM
Kazimir #2
Posted 17 August 2012 - 07:34 AM
Good, would be nice add a function to encryption and decryption the file
ciba43 #3
Posted 17 August 2012 - 09:46 AM
And you could add auto 'pass' file creation.
dimitriye98 #4
Posted 25 August 2012 - 10:40 AM
Comparing directly is a bad idea, modern day computers use a hash function and so should you.
fox8091 #5
Posted 03 January 2013 - 01:35 PM
No pastebin? :(/>
rhyleymaster #6
Posted 04 January 2013 - 10:27 PM
for the file pass, Why not add a SHA hash for the password to be stored in, and if your going to being using that method of auto creation of file: pass, Create a screen that if fs.exists("pass) = false then it will open a screen asking for what you password will be (only if fs.exists = false so that if there is no pass file, it creates one)
KronixGames #7
Posted 09 January 2013 - 10:48 PM
No pastebin? :(/>
sorry, i forgoted that