Writing my own OpenCL obfuscator :(

Captain's Log: Stardate 77607.2

You just never think that you're going to have to write your own OpenCL obfuscator... until you do. It boggles my mind that there's not a decent one out there. I think I evaluated around 5 repos I found on github, and all of them were either totally broken, or didn't actually obfuscate things. All I wanted was something to strip comments and replace symbols with gibberish, ideally keeping everything on its original line so that if there are errors it's easy to cross-reference with the original source file.

I guess the fact that such a thing doesn't exist is basically a testament to how little OpenCL is used in this kind of consumer binary... which is more evidence that I should be using CUDA. But I don't want to start on the CUDA / MTL ports until the physics are done, since I don't want to have to update 3 implementations every time I add a feature. (Hindsight says, start with CUDA next time.)

But anyway, it only took about 100 lines of Python using the clang library to get an obfuscator that works perfectly. Line numbers are preserved, variables are renamed to just numbers like _0, _1, _2, etc, and comments are gone. This is another annoying but important task to knock out for any kind of binary release, so I'm happy it's done.


© 2024 Anukari LLC, All Rights Reserved
Contact Us|Legal