Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Args = {...}
- FF = fs.open(Args[2],"rb")
- FF2 = fs.open("."..Args[2],"wb")
- print("The longer the password the harder to crack a file "..
- "If the password is one character long then the "..
- "file is easy to crack")
- write("Password: ")
- z = read(string.char(4))
- local Increm = {}
- for i = 1,string.len(z) do
- table.insert(Increm,string.byte(string.sub(z,i,i+1)))
- end
- if Args[1] == "enc" then
- repeat
- for i = 1,#Increm do
- Char = FF.read()
- if Char ~= nil then
- for ii = i,#Increm do
- Char = Char+Increm[ii]
- end
- --Char = Char+string.byte(string.sub(z,i,string.len(z)-(string.len(z)-i)))
- while Char >= 255 do Char = Char-255 end
- FF2.write(Char)
- end
- end
- until Char == nil
- elseif Args[1] == "dec" then
- repeat
- for i = 1,#Increm do
- Char = FF.read()
- if Char ~= nil then
- for ii = i,#Increm do
- Char = Char-Increm[ii]
- end
- --Char = Char-string.byte(string.sub(z,i,string.len(z)-(string.len(z)-i)))
- while Char <= 0 do Char = Char+255 end
- FF2.write(Char)
- end
- end
- until Char == nil
- end
- FF.close()
- FF2.close()
- fs.delete(Args[2])
- fs.move("."..Args[2],Args[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement