Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local h1, h2, h3 = debug.gethook()
- debug.sethook()
- local gsub = string.gsub
- local char = string.char
- local byte = string.byte
- local bitXor = bitXor
- local function encodeCaesarXor(str, key)
- return (gsub(str, '.', function(s)
- return char(((bitXor(s:byte(s), 5) + key) % 256))
- end))
- end
- local function decodeCaesarXor(str, key)
- return (gsub(str, '.', function(s)
- return char(((bitXor(byte(s)-key, 5)) % 256))
- end))
- end
- local function caesar(str, key)
- return (gsub(str, '.', function(s)
- return char((byte(s) + key) % 256)
- end))
- end
- local file = fileOpen('1.dff')
- local buffer = fileRead(file, file.size)
- fileClose(file)
- local t=getTickCount()
- buffer = caesar(buffer, 1)
- print('ms: '..(getTickCount()-t))
- local file = fileCreate('3.dff')
- local buffer = fileWrite(file, buffer)
- fileClose(file)
- debug.sethook (_, h1, h2, h3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement