require "CRC32" require "minipc" --Read hash local pwd = "" for i=1,8 do c = minipc.eepromRead(i-1) if c == 0 then pwd = nil break end pwd = pwd .. string.char(c) end if pwd then io.stdout:write("Please enter your password: ") line = io.stdin:read("*line") hash = string.format("%08X", CRC32.Hash(line)) if hash == pwd then io.stdout:write("Password is correct :-)") else io.stdout:write("Password is wrong :-(") end else io.stdout:write("Please enter a new password: ") line = io.stdin:read("*line") hash = string.format("%08X", CRC32.Hash(line)) for i=1,8 do minipc.eepromWrite(i-1, string.byte(hash, i)) end end