[RELEASE] [DEV TOOL] Lua XOR Cipher

Hello FiveM Community.

A script can convert encrypt or decrypt all text-based data using the xor algorithm.

Features

  • Possible to Encode and also Decode data using the xor algorithm
  • Support all string-based data to xor that (also for files can use file base64 to do xor on it this will be up to you how to do that)
  • Standalone it doesn’t use any function from anywhere
  • Optimize and get low usage (0.00 and max 0.01 on working)
  • Clean coding

Simple Xor Explain

xor

Resource preview

Script Tested

image

Other Tools Tested

image

More info

Example Code

  local key = "BZY"
  local enc,enc2 = XOR_Ecode("My Name Is BaziForYou",key)
  print(json.encode(enc))
  print(enc2)
  local Dec,Dec2 = XOR_Decode(enc,key)
  print(json.encode(Dec))
  print(Dec2)
  local Dec3,Dec4 = XOR_Decode(enc2,key)
  print(json.encode(Dec3))
  print(Dec4)

Used Data

Target Text: My Name Is BaziForYou
Target Key: BZY

Used Tools

Requirements

  • Need to know what xor and how to use that on your resources
  • Brain

Github

Download & Installation

Installation

Install as script
  • Add this in your server.cfg in the following order:
start cfx-xor
load as share file
  • add this to your resource manifest
shared_script '@cfx-xor/xor.lua'

Exports

Client/Server
Export Description Parameter(s) Return type
XOR_Ecode return xor encrypted data sentString [string],sentKey [string],customSpace [optional string] Table,String
XOR_Decode return xor decrypted data sentData [table or string],sentKey [string],customSpace [optional string] Table,String

Example

Using Export
local encTable,encString = exports["cfx-xor"]:XOR_Ecode("My Name Is BaziForYou", "BZY")
local decTable,decString = exports["cfx-xor"]:XOR_Decode("0F 23 79 0C 3B 34 27 7A 10 31 7A 1B 23 20 30 04 35 2B 1B 35 2C", "BZY")
Using as shared file
local encTable,encString = XOR_Ecode("My Name Is BaziForYou", "BZY")
local decTable,decString = XOR_Decode("0F 23 79 0C 3B 34 27 7A 10 31 7A 1B 23 20 30 04 35 2B 1B 35 2C", "BZY")

Credits

Additional info

Code is accessible Yes
Subscription-based No
Lines (approximately) ~ 67 lines
Requirements Nothing special just brain
Support Yes
11 Likes

Amazing

1 Like

nice one

1 Like

why does not encrypt from outside, insted of charge load on server…

2 Likes

As a programming practice it is very good, but it is really impractical since XOR is quite easy to decrypt.
But it’s ok!

As for why it is used from the server instead of external, I imagine for the simple fact of using the power of lua which is a non-compiled language and not using other languages that most users would not know how to use, right?

1 Like

What is the use case for this script? How can any server benefit from this?

2 Likes

what do you mean it’s not encrypting way for lock scripts its a cipher tool for data in most ways text-based info I recommend search about xor cipher

It can be correct and no in the most way for decrypting that need do brute force to find the key while you have a good key and keep that secret will be good but for small info still can get brute force

hmmm yes i can say most know how to use it

as I said in here it’s a tool and users need to know how to use it or what they want cipher using a custom key and keep info and anytime he wany get original data so I can’t tell you where you should use like some users using sha256 for password security and some use for validating data but still have lots of other usages there are just algorithm to hash or cipher data