Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function encryptFile(filePath, encryptedFilePath, key)
- local decryptedFile = fileOpen(filePath, true)
- if decryptedFile then
- local fileContent = fileRead(decryptedFile, fileGetSize(decryptedFile))
- fileClose(decryptedFile)
- fileContent = teaEncode(fileContent, key)
- if fileContent then
- local encryptedFile = fileCreate(encryptedFilePath)
- if encryptedFile then
- fileWrite(encryptedFile, fileContent)
- fileFlush(encryptedFile)
- fileClose(encryptedFile)
- return true
- end
- end
- end
- return false
- end
- function decryptFile(filePath, decryptedFilePath, key)
- local encryptedFile = fileOpen(filePath, true)
- if encryptedFile then
- local fileContent = fileRead(encryptedFile, fileGetSize(encryptedFile))
- fileClose(encryptedFile)
- local fileContent = teaDecode(fileContent, key)
- if fileContent then
- local decryptedFile = fileCreate(decryptedFilePath)
- if decryptedFile then
- fileWrite(decryptedFile, fileContent)
- fileFlush(decryptedFile)
- fileClose(decryptedFile)
- return true
- end
- end
- end
- return false
- end
- addEventHandler("onClientResourceStart", resourceRoot,
- function ()
- local key = "K3TOEQaK7W+KZ1m4"
- encryptFile("car.txd", "e_car.txd", key)
- decryptFile("e_car.txd", "d_car.txd", key)
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment