
Single-header C++20 software protection SDK with polymorphic VM code virtualization, compile-time MBA and string obfuscation, 25+ crypto primitives, anti-debug/anti-dump, and HWID licensing.
aegis_protection.hpp)Single-Header C++20 Code Virtualization, Obfuscation, Cryptography & Anti-Tamper SDK
Industrial-grade zero-dependency single-header C++20 software protection SDK (10,145+ lines of code in a single .hpp file): hybrid stack-register Virtual Machine with polymorphic bytecode, C-like script-to-V-ISA compiler, 25+ cryptographic primitives, compile-time obfuscation, anti-debugging, runtime memory integrity watchdog, encrypted VFS, and hardware-bound licensing.
No external dependencies, complex build scripts, or clutter — strictly the single-header SDK and its verification test suite:
├── aegis_protection.hpp # Single-header C++20 SDK (10,145 LOC, 67 integrated subsystems)
├── test_all_in_one.cpp # Complete verification suite (20 test suites + 12 crypto KAT checks)
└── README.md # Bilingual documentation & developer manual (EN / RU)
Include aegis_protection.hpp directly in your C++20 project:
#include "aegis_protection.hpp"
cl /std:c++20 /EHsc /W4 /O2 test_all_in_one.cpp /Fe:test_all_in_one.exe
.\test_all_in_one.exe
clang++ -std=c++20 -O2 -Wall -Wextra test_all_in_one.cpp -o test_all_in_one
./test_all_in_one
flowchart LR
A["Source Logic / Script"] --> B["AegisScript / BytecodeBuilder"]
B --> C["IR Obfuscation Passes<br/>(Constant Blinding, MBA, Junk)"]
C --> D["Polymorphic Opcode Map<br/>(Compile-Time Shuffle)"]
D --> E["Rolling-Key Cipher<br/>+ BytecodeEnvelope"]
E --> F["Aegis Virtual Machine<br/>(MBA Dispatch + Ephemeral Wipe)"]
G["IntegrityWatchdog + VEH Guard"] --> F
| Category | Namespace | Key Classes & Capabilities |
|---|---|---|
| Code Virtualization (VM) | aegis::vm | VirtualMachine, BytecodeBuilder, BytecodeChunk, VMContext, NativeBridge, PolymorphicOpcodeMap (compile-time Fisher-Yates 256-opcode permutation), extended V-ISA (OP_BSWAP, OP_POPCNT, OP_VMEMCPY, OP_VMEMSET, OP_REKEY, OP_JUNK) |
| VM Compiler & Toolchain | aegis::vm::* | AegisScriptCompiler (compiles C-like scripts to V-ISA bytecode), VmTextAssembler (text assembler with labels), BytecodeDisassembler (+ CFG builder), BytecodeDecompiler (lifts bytecode to C pseudocode), BytecodeObfuscationPipeline, SsaLifter (SSA + Linear Scan allocator), BytecodeAbstractInterpreter, VMProfiler, VMDebugger |
| Compile-Time Obfuscation | aegis::obf | Mba (Mixed Boolean Arithmetic), AEGIS_STR / AEGIS_STR_OBJ (constexpr string encryption with automatic stack zeroization), AEGIS_INT / ObfuscatedInt, Opaque predicates, FlatteningMachine (Control Flow Flattening), EncryptedDispatchTable |
| Symmetric Ciphers & AEAD | aegis::crypto | Aes256 (ECB/CBC/CTR + PKCS#7), ChaCha20, ChaCha20Poly1305 (RFC 8439 AEAD), XChaCha20 (192-bit nonce), Salsa20, Camellia256 (RFC 3713), Serpent256 (32-round SPN), Threefish512 (72 rounds), Blowfish, Rc6_256, Speck128, Simon128, Sm4, XTea |
| Cryptographic Hashes & KDF | aegis::crypto | Sha256 (FIPS 180-4 + HMAC), Sha512 / Sha384 (+ HMAC), Keccak1600 (sha3_256, sha3_512, shake256), Blake2b, Blake2s, Ascon320 (NIST SP 800-232), Sm3, Poly1305, SipHash24, KdfEngine (pbkdf2_hmac_sha256, hkdf_extract/expand, memory_hard_derive), ChaCha20Drbg (CSPRNG + UUIDv4) |
| Public-Key, Secret Sharing & ECC | aegis::crypto / aegis::math | X25519 (RFC 7748 Curve25519 ECDH), Uint256 (mod_add, mod_mul, mod_pow), ShamirSecretSharing (threshold $(K, N)$ in $GF(2^8)$), SelfHealingBuffer (Hamming SEC-DED + XOR parity recovery in RAM), MerkleTree (inclusion proofs), WhiteBoxByteNetwork |
| Anti-Debug & Memory Defense | aegis::anti / aegis::veh / aegis::watchdog / aegis::syscall | AntiDebug (PEB, NtGlobalFlag, Dr0–Dr7, RDTSC, ThreadHideFromDebugger, ProcessDebugPort), AntiVm (CPUID hypervisor vendor, MAC, registry), EmulatorDetector (IEEE-754 NaN payload fidelity), AntiDump (erase_pe_headers), IntegrityScanner, CodePatchGuard, ApiResolver (IAT-free AEGIS_API), SyscallResolver (ntdll.dll SSN extraction & hook detector), VehGuard (hardware breakpoint scrubber), IntegrityWatchdog (background monitoring thread) |
| Licensing, VFS & Watermarking | aegis::license / aegis::archive / aegis::watermark | LicenseManager (AEGIS-XXXX-... keys with HWID binding & ChaCha20-Poly1305), AegisVfsArchive (encrypted virtual filesystem with LZSS compression), BytecodeWatermarker (steganographic customer watermarks), HardwareId (TPM 2.0 EKPub + CPUID), PeImageAnalyzer, UniversalBinaryInspector (PE/ELF64/Mach-O), SecurePacketChannel, EncryptedRingLogger, JsonParser |
aegis_protection.hpp is 100% header-only. On Windows, required system libraries (ncrypt.lib, crypt32.lib, advapi32.lib, psapi.lib, iphlpapi.lib) are linked automatically via #pragma comment(lib, ...).
Visual Studio (.vcxproj):
aegis_protection.hpp into your project directory.ISO C++20 Standard (/std:c++20).#include "aegis_protection.hpp" to your .cpp file.CMake (CMakeLists.txt):
cmake_minimum_required(VERSION 3.20)
project(ProtectedApp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(ProtectedApp main.cpp aegis_protection.hpp)