AEGIS

Aegis documentation

Everything you need to protect Lua & Luau code for Roblox and FiveM - and how tokens work.

Overview

Aegis transforms readable Lua/Luau source into protected code. You can use it on Roblox (Luau) and FiveM (Lua 5.4). Each encrypted file costs 1 token (the exact cost is configurable by the admin).

Source mode

Keeps your output as valid Lua. Fastest, most compatible.

VM mode

Compiles to a custom bytecode VM. Strongest protection.

Getting started

01

Create an account

Sign up or sign in from the navbar.

02

Add tokens

Buy a plan or redeem a key in the dashboard.

03

Encrypt

Paste your Lua, choose your macros, hit Encrypt.

04

Ship it

Download the protected file and deploy anywhere.

Protection layers

Each layer is an independent toggle in the dashboard.

String encryption

Every string literal is XOR-encrypted with a unique key and decoded by a memoizing helper at runtime. Plaintext never appears in the output, and repeated reads stay fast thanks to caching.

Number obfuscation

Integer constants become exact arithmetic expressions; floats become exact integer division. Hardcoded numbers disappear from the source.

Control-flow flattening

Statement lists become a shuffled state machine (while true / if state == N ...). The original order of your logic is destroyed.

Variable renaming

Scope-aware renaming scrambles locals, labels and (optionally) globals. Source identifiers are reserved first so generated names never collide.

Custom bytecode VM

VM only

Compiles your program into a custom register-based instruction set and ships a self-contained Lua interpreter. String constants are encrypted in the constant pool.

Aegis macros (AEG_*)

Aegis ships its own macro family (modeled on Luraph's LPH_* macros). Macros are marker functions: Aegis never renames them and always protects their string/number arguments. You can call them freely - the runtime stubs below make them safe no-ops during local development.

Runtime stubs (safe no-op definitions)
-- Paste at the top of your source (or include aegis.lua):
local function AEG_OBFUSCATED() return nil end
local function AEG_ENCSTR(s) return s end
local function AEG_ENCNUM(n) return n end
local function AEG_ENCBUF(buf) return buf end
local function AEG_OPAQUE(x) return x end
local function AEG_CRASH() error("unreachable", 2) end
local function AEG_STACKALLOC(n) return n or 0 end
local function AEG_PRECHECK(c, m) if not c then error(m or "precheck", 2) end return true end
local function AEG_REWRITE() return nil end
local function AEG_LINE(n) return n end
local function AEG_NO_VIRTUALIZE(fn) return fn end
local function AEG_NO_OBFUSCATE(x) return x end

AEG_OBFUSCATED()

AEG_OBFUSCATED()

Marks a scope or function for full protection. A compatibility marker - with Aegis everything is already protected by default.

AEG_ENCSTR("text")

local k = AEG_ENCSTR("secret")

Explicitly marks a string literal for encryption.

AEG_ENCNUM(n)

local x = AEG_ENCNUM(1337)

Explicitly marks a number for obfuscation.

AEG_ENCBUF(buf)

local b = AEG_ENCBUF(bytes)

Explicitly marks a byte buffer for protection.

AEG_OPAQUE(x)

local v = AEG_OPAQUE(input)

Returns an opaque value the compiler cannot constant-fold away.

AEG_CRASH()

AEG_CRASH()

Stops execution if reached - useful as a dead-code trap.

AEG_STACKALLOC(size)

AEG_STACKALLOC(16)

Hints the obfuscator to reserve a scratch stack frame.

AEG_PRECHECK(cond, msg)

AEG_PRECHECK(x > 0, "bad x")

Assertion helper that errors when the condition is false.

AEG_REWRITE()

AEG_REWRITE()

Requests a control-flow rewrite of the enclosing scope.

AEG_LINE(n)

AEG_LINE(42)

Source line marker (compatibility no-op).

AEG_NO_VIRTUALIZE(fn)

AEG_NO_VIRTUALIZE(function() ... end)

Prevents virtualization of the marked function.

AEG_NO_OBFUSCATE(x)

AEG_NO_OBFUSCATE(value)

Prevents any obfuscation of the marked value.

Need the full file? Download aegis.lua and include it at the top of your source.

Protected file header

Every encrypted file starts with a versioned Aegis header on line 1, a blank line 2, and your protected code from line 3 onward. The build number changes with each release.

-- This file was protected by Aegis Obfuscator Build 1.0.0 [https://aegisob.com]

-- (your protected code starts here, line 3)

VM support matrix

Closures & upvalues Supported
Recursion Supported
Method calls (a:b(...)) Supported
Tables (array + dict) Supported
Varargs (...) Supported
Bitwise operators (& | ~ << >>) Supported
Numeric for / while / repeat Supported
break Supported
Generic for ... in loopsFalls back to source mode
continueFalls back to source mode
goto / labelsFalls back to source mode

Tokens & plans

Encrypting one file costs 1 token (configurable). Get tokens by buying a plan or redeeming a key. Plans are monthly or one-time, each carrying a token amount and a buy URL - clicking Buy now sends you to the checkout URL the admin configured.

API options

OptionDescription
vmUse the custom bytecode VM (strongest protection).
stringsEncrypt all string literals.
numbersObfuscate numeric literals.
flattenApply control-flow flattening.
renameRename locals and labels.
renameGlobalsAlso rename globals (except preserved).
preserveArray of globals to keep readable (AEG_* macros are always preserved).
seedFixed seed for reproducible output.

Security honesty note

No obfuscator can guarantee "unbreakable" protection. Any code a machine must run can eventually be read by a skilled reverse engineer. Aegis raises that bar dramatically - custom VM, encrypted strings, flattened control flow and name scrambling - but treat it as a strong deterrent, not as cryptography.