Advertisement
Alakazard12

encrypt

Dec 24th, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local tArgs = {...}
  2.  
  3. if #tArgs < 2 then
  4.     error("Usage: en <1/2> <path>")
  5. end
  6.  
  7. if tArgs[1] == "1" then
  8.     local newt = ""
  9.     local rd = fs.open(tArgs[2], "r")
  10.     local txt = rd.readAll()
  11.     rd.close()
  12.     for i = 1, #txt do
  13.         newt = newt..string.char(string.byte(string.sub(txt, i, i))+1)
  14.     end
  15.     local fl = fs.open(tArgs[2], "w")
  16.     fl.write(newt)
  17.     fl.close()
  18. elseif tArgs[1] == "2" then
  19.     local newt = ""
  20.     local rd = fs.open(tArgs[2], "r")
  21.     local txt = rd.readAll()
  22.     rd.close()
  23.     for i = 1, #txt do
  24.         newt = newt..string.char(string.byte(string.sub(txt, i, i))-1)
  25.     end
  26.     local fl = fs.open(tArgs[2], "w")
  27.     fl.write(newt)
  28.     fl.close()
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement