Obfuscation vs encryption for game server scripts
Latch team · 2026-12-05 · 5 min read
When a script or plugin leaks, the first search is usually for a tool: a Java obfuscator for a Minecraft or Hytale plugin, a Node.js obfuscator for a JavaScript server script, a Lua obfuscator for a Lua resource. Obfuscation is a real tool and it has a place. It just isn't the same thing as encryption, and the two get mixed up a lot.
This post explains what each one actually stops for Java plugins and Node.js server scripts (with a note on Lua), why encryption only works when it comes with licensing, and how the two fit together.
The short version
Obfuscation changes how code looks. It renames things, scrambles structure and hides strings, but the result is still a complete, working program. Anyone who has the file can run it, and with enough patience, read it.
Encryption changes who can read the code at all. An encrypted file is unreadable without a key. If that key isn't in the file and is only handed to servers you approved, then whoever holds the key decides where the code runs. That second part, deciding who gets the key, is licensing.
What obfuscation does in practice
Java plugins (Minecraft, Hytale)
Java compiles to bytecode that keeps class names, method names and string constants. Free decompilers like CFR and Vineflower turn a .class file back into readable Java. A Java obfuscator such as ProGuard renames your classes, methods and fields and removes unused code; commercial obfuscators add string encryption and control-flow changes on top.
What stays visible:
- Calls into the game server's API keep their real names, because they must match the server's classes. They describe what your plugin does.
- Your entry point keeps its name, since the plugin manifest refers to it. Anything loaded by reflection needs keep rules.
- Download markers can be renamed along with everything else. BuiltByBit's placeholder docs recommend excluding placeholder strings from obfuscation for that reason.
Most importantly, an obfuscated JAR still runs on any server it's copied to.
Node.js server scripts
JavaScript is shipped as source, so without any processing your server script is plain text. javascript-obfuscator, the best-known Node.js obfuscator, renames variables, extracts and encrypts strings, flattens control flow, and offers VM bytecode obfuscation in its Pro version.
The limits are the same as with Java. The output is still JavaScript that the runtime executes, so it runs anywhere the file goes. Heavier options make the code larger and slower, and your own stack traces get harder to read when something breaks on a customer's server.
A note on Lua
Lua obfuscators work the same way. Prometheus, an open-source Lua obfuscator, uses techniques like VM virtualization, control-flow flattening and constant encryption, and supports Lua 5.1 with basic Luau support. For comparison, FiveM's Asset Escrow encrypts Lua resources and only starts them on servers with the right entitlement; its documentation says obfuscating code in escrowed resources is not necessary. That's encryption plus licensing applied to Lua. Latch doesn't protect Lua scripts today; it covers JavaScript server code for MafiaHub frameworks and Java plugins for Hytale.
What encryption plus licensing does
Encryption on its own isn't enough. If the decryption key ships inside the package, anyone can decrypt it, and you've built obfuscation with extra steps. It only works when the key is kept somewhere else and handed out under rules.
That's the model Latch uses, as described in How protection works:
- Server code is encrypted with a key unique to that script. The download has no plain-text server code.
- The decryption key is never in any file. Each server start is verified with the server's license key before the code can be decrypted.
- Code is decrypted in memory only and never written to disk. Modified packages won't run.
- Access is granted per account, and one license key runs on one server at a time. Revoke access and the script stops at its next check.
- Every downloaded package carries an invisible mark linked to the account, so a leaked copy can be traced.
Obfuscation asks "how long will it take someone to understand this?" Encryption plus licensing asks "who is allowed to run this at all?"
Side by side
| Situation | Obfuscation | Encryption + licensing |
|---|---|---|
| Opening the file to read the code | Slower, still possible | No plain code in the file |
| Running a copied file on another server | Works | Refused without a license |
| One license used on several servers | Not covered | Refused and flagged |
| Finding out who leaked a copy | Only with your own markers | Mark per account |
| Cutting off access later | Not possible | Revoke the account |
| Code the game sends to players | Works | Not possible: players' games must read it |
| Full control of the server, memory dumps | Harder | Harder, not impossible |
The last two rows matter. Encryption can't help with files that have to be readable on a player's machine, and no protection for code running on someone else's hardware is 100%. A determined person with full control of a server may still extract code from memory. The goal is to stop unlicensed use and make reaching the source impractical, and to let you act when abuse shows up.
They work best together
The two methods cover different files, so a good setup uses both.
MafiaHub resources (Arcane MP, Kingdoms Connected, Mafia 2 Online, Fallout MP) have server scripts and client scripts. The upload docs describe what Latch does with each:
- Server scripts and other server
.js/.jsonfiles are encrypted and only run with a valid license. - Client scripts, shared scripts and files the game sends to players can't be encrypted, so their JavaScript is obfuscated instead.
- Files you want server owners to edit, like a config, stay readable when you list them under
latch.ignore.
"mafiahub": {
"serverScripts": ["dist/server.js"],
"clientScripts": ["dist/client.js"],
"files": ["dist/client.js"]
},
"latch": {
"ignore": ["config.json"]
}
Inside the encrypted package, server code is also obfuscated by default, so both layers apply. If your code reads its own source or local variable names at runtime, you can turn that off with "obfuscateServer": false in the latch block, and "obfuscateClient": false ships client JavaScript as written.
Hytale plugins run entirely on the server, so there's nothing that has to stay readable for players. Your .class files and resources are encrypted and decrypted only in the running server's memory (see Hytale plugins). Asset packs streamed to players, like models and textures, can't be protected, so keep them out of the code JAR.
One practical tip: don't run your server JavaScript through an obfuscator before uploading it to Latch. Latch protects it, and every upload goes through a code scan; obfuscated code is one of the findings that holds a version for review by the Latch team before it reaches anyone. Upload your normal build and let the platform handle it.
Which one do you need?
- Open-source or free-to-share code: neither. Readability is a feature.
- Code the game sends to players: obfuscation is the only option, because the client has to read it.
- Server code you want to control: encryption plus licensing, with obfuscation as an extra layer inside.
- Code you want to trace when it leaks: per-download marks, either your own or the platform's.
Next step
If your scripts are MafiaHub resources or Hytale plugins, you can try both layers on one script on the Free plan, with no card required. The How protection works page has the short version of the model, and Explore shows scripts other studios already publish with Latch.