Advertisement
incinirate

File Encrypter

Sep 29th, 2014
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local tArgs = {...}
  2. if fs.exists(tArgs[1]) and not fs.isDir(tArgs[1]) then
  3.   local file = fs.open(tArgs[1],"r").readAll()
  4.   local cryp = "local run = [["
  5.   for i=1,#file do
  6.     cryp = cryp..string.char(string.byte(file:sub(i,i))+1)
  7.   end
  8.   cryp = cryp.."]]\n\n"
  9.   cryp = cryp..[[
  10.   local tbl = {...}
  11.   local exc = ""
  12.   for i=1,#run do
  13.     exc = exc..string.char(string.byte(run:sub(i,i))-1)
  14.   end
  15.   loadstring(exc)(unpack(tbl))
  16.   ]]
  17.   write("Save as: ")
  18.   local dest = read()
  19.   local final = fs.open(dest,"w")
  20.   final.write(cryp)
  21.   final.close()
  22. else
  23.   printError("Incompatible File")
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement