IronBrew 2 provides powerful string encryption capabilities to protect sensitive data and hide script logic from reverse engineering.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pw4k/ironbrew-2/llms.txt
Use this file to discover all available pages before exploring further.
Overview
String encryption uses XOR cipher with dynamically generated decryption tables. At runtime, encrypted strings are decrypted by the virtual machine using inline decryption functions.Encryption Modes
Full String Encryption
WhenEncryptStrings is enabled, all string constants in your Lua script are encrypted:
Important Strings
For targeted protection, enableEncryptImportantStrings to encrypt only strings containing sensitive keywords:
http- URLs and web requestsfunction- Function namesmetatable- Metatable operationslocal- Variable declarations
IronBrew2/Obfuscator/Encryption/ConstantEncryption.cs:206.
Manual String Marking
You can explicitly mark strings for encryption using the[STR_ENCRYPT] prefix:
How Encryption Works
XOR Cipher Implementation
IronBrew 2 uses XOR encryption with random byte tables:- Table Generation: A random byte table is generated with length up to
DecryptTableLen - Encryption: Each byte in the string is XOR’d with the corresponding table position (cycling)
- Inline Decryption: The VM injects a decryption function that reverses the process at runtime
ConstantEncryption.cs:18:
Decryption Function
The generated decryption code is injected inline:DecryptTableLen Configuration
TheDecryptTableLen setting controls the maximum size of decryption tables:
Maximum decryption table length. The actual table size is determined by:
- The longest string in your script
- The
DecryptTableLenlimit (whichever is smaller)
- Small scripts: 200-300
- Medium scripts: 500 (default)
- Large scripts: 750-1000
ConstantEncryption.cs:44:
Examples
Before Obfuscation
With EncryptImportantStrings
Only the string containing “http” and “function” context are encrypted:With EncryptStrings
All strings are encrypted:Combining with Other Features
String encryption works seamlessly with other obfuscation features:- Strings are encrypted and hidden
- Control flow is flattened and obscured
- Instructions are mutated and folded
Performance Impact
String decryption happens once per string at load time, not on every access. The performance impact is primarily during script initialization.
- EncryptImportantStrings: +5-15% initialization time
- EncryptStrings: +20-40% initialization time
- Runtime: Negligible (strings are decrypted once)
Best Practices
Use EncryptImportantStrings for most cases
Use EncryptImportantStrings for most cases
This provides good protection for sensitive data without encrypting benign strings like error messages.
Reserve EncryptStrings for high-security needs
Reserve EncryptStrings for high-security needs
Full encryption is best for scripts containing proprietary algorithms or sensitive business logic.
Adjust DecryptTableLen based on script size
Adjust DecryptTableLen based on script size
Larger scripts with long strings benefit from higher values (750-1000).
Manually mark critical strings
Manually mark critical strings
Use
[STR_ENCRYPT] prefix for API keys, tokens, and other secrets to ensure they’re always protected.Source References
- Encryption implementation:
IronBrew2/Obfuscator/Encryption/ConstantEncryption.cs - Settings definition:
IronBrew2/Obfuscator/ObfuscationSettings.cs:5-9 - XOR encryption:
ConstantEncryption.cs:17-27