ObfuscateMacro icon indicating copy to clipboard operation
ObfuscateMacro copied to clipboard

how to use

Open ximlu opened this issue 1 year ago • 3 comments

Hello, may I ask if there are any examples used in engineering? I am not quite sure how to use them.

ximlu avatar Jan 24 '24 15:01 ximlu

Simply add it as a swift package to the dependencies and then replace it with the following

import ObfuscateMacro

let text = "hello"

// ↓↓

let text = #ObfuscatedString("hello")

Didn't work well?

p-x9 avatar Jan 25 '24 15:01 p-x9

Yes, thank you. I now know how to use it. At first, I was not sure about the principle behind it, so I spent a lot of time researching. It would be great if there could be a brief explanation of the principle behind it in markdown.

sjustfly avatar Jan 26 '24 00:01 sjustfly

@sjustfly

Yes certainly, I agree with you.

Since the source code itself is compiled after the macros are expanded, the only data left on the actual binary is after obfuscation. Each time a string is retrieved, it is decoded. Also, the macro changes the seed used for obfuscation each time it is executed.

I think these are the main principles.

I welcome pull requests to update the README if you would like to do so.

Thanks.

p-x9 avatar Jan 26 '24 05:01 p-x9