https://github.com/deniskore/nand_nor
C++ Compile time NAND/NOR obfuscation
https://github.com/deniskore/nand_nor
compile-time emulation nand nor obfuscation security
Last synced: about 1 year ago
JSON representation
C++ Compile time NAND/NOR obfuscation
- Host: GitHub
- URL: https://github.com/deniskore/nand_nor
- Owner: Deniskore
- License: mit
- Created: 2019-12-31T07:01:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T19:39:46.000Z (over 6 years ago)
- Last Synced: 2025-03-29T20:51:12.003Z (about 1 year ago)
- Topics: compile-time, emulation, nand, nor, obfuscation, security
- Language: C++
- Homepage:
- Size: 74.2 KB
- Stars: 51
- Watchers: 7
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prerequisites
- ~~MSVC 2019+~~ It's better to use [clang-cl](http://llvm.org/builds/) because of [this bug](https://developercommunity.visualstudio.com/content/problem/873112/extremely-long-compilation-time-when-using-compile.html)
- Clang 7.0+
- GCC 8.3+
- Gtest
- CMake
- Ninja build (optional)
For Windows:
Use [vcpkg](https://github.com/microsoft/vcpkg/) or [conan](https://github.com/conan-io/conan) package managers to install Gtest library
For Linux (depends on your distro):
Ubuntu
```
sudo apt-get install libgtest-dev
```
Fedora
```
sudo dnf install gtest-devel
```
# Building
Don't forget to specify toolchain file if you use package managers (-DCMAKE_TOOLCHAIN_FILE=...)
```
cmake -G "Ninja" ..
ninja
```
### Diff
For each compilation you will get different assembly code
```c++
uint64_t diff_me(uint64_t x) {
using u64 = uint64_t;
CNNInt r(std::chrono::system_clock::now().time_since_epoch().count());
CNNInt test(x);
test++;
test--;
test|=r;
test^=r;
test&=r;
test^=r;
test = ~test;
return test.value();
}
```
For example:


```
Difference (relyze.com tool)
81.13% diff_me - diff_me
```