Advertisement
KidBrine

BrineCrypt2.5B

Apr 22nd, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. Args = {...}
  2. FF = fs.open(Args[2],"rb")
  3. FF2 = fs.open("."..Args[2],"wb")
  4. print("The longer the password the harder to crack a file "..
  5.       "If the password is one character long then the "..
  6.       "file is easy to crack")
  7. write("Password: ")
  8. z = read(string.char(4))
  9. local Increm = {}
  10. for i = 1,string.len(z) do
  11.   table.insert(Increm,string.byte(string.sub(z,i,i+1)))
  12. end
  13.  
  14. if Args[1] == "enc" then
  15.   repeat
  16.     for i = 1,#Increm do
  17.       Char = FF.read()
  18.       if Char ~= nil then
  19.         for ii = i,#Increm do
  20.           Char = Char+Increm[ii]
  21.         end
  22.         --Char = Char+string.byte(string.sub(z,i,string.len(z)-(string.len(z)-i)))
  23.         while Char >= 255 do Char = Char-255 end
  24.         FF2.write(Char)
  25.       end
  26.     end
  27.   until Char == nil
  28. elseif Args[1] == "dec" then
  29.   repeat
  30.     for i = 1,#Increm do
  31.       Char = FF.read()
  32.       if Char ~= nil then
  33.         for ii = i,#Increm do
  34.           Char = Char-Increm[ii]
  35.         end
  36.         --Char = Char-string.byte(string.sub(z,i,string.len(z)-(string.len(z)-i)))
  37.         while Char <= 0 do Char = Char+255 end
  38.         FF2.write(Char)
  39.       end
  40.     end
  41.   until Char == nil
  42. end
  43.  
  44. FF.close()
  45. FF2.close()
  46. fs.delete(Args[2])
  47. fs.move("."..Args[2],Args[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement