# MoonSec Obfuscator Macros

## Encrypt a string:

If you want to encrypt a specific string, use this macro. Just add "ENCRYPT:" in a string as a prefix.

```lua
local str1 = "ENCRYPT:Hi LOL"
local str2 = [[ENCRYPT:Whats good?]]
local api = game:HttpGet("ENCRYPT:https://f3d.at")
local a = [[ENCRYPT:
Multiline
thing]]
```

## Exclude string from encryption:

If you want to encrypt all strings but a specific one, include 'NO\_ENCRYPT:' in the string.

```lua
local c = "NO_ENCRYPT:Hello there";
local f = [[NO_ENCRYPT:Hello world!]]
local x = 'NO_ENCRYPT:Hello!';
local s = [[NO_ENCRYPT:
Multiline
string
]]
```

{% hint style="warning" %}
&#x20;Strings smaller than 4 characters or longer than 512 characters will not be encrypted.
{% endhint %}

## Get decrypted string table: GetDST(\<void>)

Returns the table that stores decrypted strings. This can be used for debugging purposes or to modify a string directly from the script.

```lua
table.foreach(GetDST(), print)

for i,v in pairs(GetDST()) do
    if v == "Hello world" then
        GetDST()[i] = "New value"
    end
end

```

## EQ Macro: \_\_secureeq(variable1, variable2)

This macro is still under development and currently not public, but here is the usage.&#x20;

This macro encrypts the if-else statement and decrypts it only if statement actually equals true, therefore stops  JMP / EQ hooking based attacks to crack whitelist systems.

{% hint style="danger" %}
This macro is under development, if you use it now, it will act like a regular \_\_eq.
{% endhint %}

```lua
local WhitelistedHWID = "abcd1234" -- example string 1
local MyHWID = Player:GetHWID() -- example string 2

if __secureeq(MyHWID, WhitelistedHWID) then
    print("Authorized")
end

if __secureeq("1244", "12".."44") then
    print("Equals")
end

if __secureeq(nil, 7) then
    print("No way")
end
```

{% hint style="warning" %}
You **shouldn't** use any "or" operator to connect multiple statements while using **secureeq** macro. If one side equals true, it will cause strings to stay encrypted and **break your code.**
{% endhint %}

{% hint style="warning" %}
You **shouldn't** assign or overwrite secureeq function. You can still use it as == operator but it will not have extra security if you use it outside an if-else statement. (e.g local test = \_\_secureeq(1,2))
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cmoonm4n.gitbook.io/moonsec-obfuscator/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
