{"id":30444942,"url":"https://github.com/00nx/c-string-obfuscator","last_synced_at":"2026-07-06T14:31:38.193Z","repository":{"id":306257580,"uuid":"1025159674","full_name":"00nx/c-string-obfuscator","owner":"00nx","description":"A lightweight, header-only C++ utility for compile-time string obfuscation using XOR encryption.","archived":false,"fork":false,"pushed_at":"2026-01-29T14:20:42.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-30T03:45:46.057Z","etag":null,"topics":["c","cpp","dynamic","encryption","header","obfuscator","runtime-decryption","string","windefender","windows","xor","xor-encryption"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/00nx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-23T20:23:55.000Z","updated_at":"2026-01-29T14:20:46.000Z","dependencies_parsed_at":"2025-07-24T17:17:57.623Z","dependency_job_id":null,"html_url":"https://github.com/00nx/c-string-obfuscator","commit_stats":null,"previous_names":["00nx/c-string-obfuscator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/00nx/c-string-obfuscator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/00nx%2Fc-string-obfuscator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/00nx%2Fc-string-obfuscator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/00nx%2Fc-string-obfuscator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/00nx%2Fc-string-obfuscator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/00nx","download_url":"https://codeload.github.com/00nx/c-string-obfuscator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/00nx%2Fc-string-obfuscator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35195590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","dynamic","encryption","header","obfuscator","runtime-decryption","string","windefender","windows","xor","xor-encryption"],"created_at":"2025-08-23T10:39:08.896Z","updated_at":"2026-07-06T14:31:37.800Z","avatar_url":"https://github.com/00nx.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  C++ Compile-Time String Obfuscator (Rolling XOR)\n\n**Lightweight • Header-only • Hard-to-grep • Anti-static-analysis friendly**\n\n[![C++17](https://img.shields.io/badge/C++-17-blue?logo=c%2B%2B)](https://isocpp.org/std/the-standard)\n[![Header-only](https://img.shields.io/badge/Header--only-yes-success)](#)\n[![No dependencies](https://img.shields.io/badge/dependencies-none-important)](#)\n\n##  Features\n\n- Compile-time XOR obfuscation of string literals (`char[]` \u0026 `wchar_t[]`)\n- **Rolling XOR key stream** — different key byte per position (16-byte cycle by default)\n- Strong compile-time seed mixing (inspired by splitmix64 / wyhash)\n- Lazy decryption (happens only when you first access the string)\n- **Automatic zeroization** on scope exit (via RAII helper)\n- Very simple \u0026 clean macro syntax\n- Header-only — drop-in single file integration\n- No external dependencies, no dynamic allocation\n\n## Why better than plain single-byte XOR?\n\n| Feature                     | Classic single XOR | This version (rolling)     |\n|-----------------------------|--------------------|-----------------------------|\n| Key per string              | 1 byte             | 16-byte cycling stream      |\n| Static analysis resistance  | Low                | Significantly higher        |\n| Easy to grep / pattern match| Very easy          | Much harder                 |\n| Key derivation              | Weak shifts/mul    | Strong mixer (wyhash-like)  |\n| Memory cleanup              | Manual             | Automatic RAII              |\n\n## Quick Start\n\n```cpp\n#include \"obfuscator.h\"\n\nint main()\n{\n    // Most common \u0026 safest way — decrypt + auto-zeroize when leaving scope\n    const char* msg = OBF_AUTO(\"kernel32.dll\");\n\n    // One-time decrypt (stays decrypted until program ends or zeroized manually)\n    const char* api = OBF(\"CreateRemoteThread\");\n\n    // Wide string versions\n    const wchar_t* wpath = OBF_W_AUTO(L\"C:\\\\Windows\\\\Temp\\\\payload.bin\");\n\n    wprintf(L\"Path: %s\\n\", wpath);\n    printf(\"API name: %s\\n\", api);\n\n    // You can also use it inside functions, conditions, etc.\n    if (some_condition) {\n        MessageBoxA(NULL, OBF_AUTO(\"Critical error!\"), OBF(\"Error\"), MB_ICONERROR);\n    }\n}\n```\n\n## Available Macros\n\n| Macro              | Behavior                                           | Recommended? | Lifetime of decrypted data          |\n|--------------------|----------------------------------------------------|--------------|-------------------------------------|\n| `OBF(\"...\")`       | Lazy decrypt, stays decrypted in memory forever    | Sometimes    | Until program ends                  |\n| `OBF_AUTO(\"...\")`  | Decrypt + **auto zeroize** when leaving scope      | **Yes**      | Only while in current scope         |\n| `OBF_W(\"L...\")`    | Wide version — lazy decrypt                        | Sometimes    | Until program ends                  |\n| `OBF_W_AUTO(\"L...\")`| Wide version + **auto zeroize** on scope exit     | **Yes**      | Only while in current scope         |\n\n**Recommendation**: Use `OBF_AUTO` / `OBF_W_AUTO` in most cases — it's significantly safer as it minimizes the time sensitive strings remain in plaintext in memory.\n\n\n## Performance Overview\n\nAll numbers are approximate, measured on modern hardware (Zen 4 / Intel 13th–14th gen, 2024–2025 compilers) with `-O3 -march=native`.\n\n| Scenario                          | Plain literal (ns) | This lib (ns)     | Vectorized xorstr-style (ns) | Overhead factor | Notes |\n|-----------------------------------|--------------------|-------------------|------------------------------|-----------------|-------|\n| Short string (~8–16 chars), cold  | 0.5–2             | 10–25            | 4–12                        | ~10–20×        | First decrypt dominates |\n| Short string, hot (cached)        | 0.5–2             | ~1–3             | ~1–2                        | ~1–3×          | After decrypt(), near-zero cost |\n| Medium (~32–64 chars), cold       | 1–4               | 15–45            | 5–15                        | ~5–15×         | Modulo can limit auto-vectorization |\n| Medium, hot                       | 1–4               | ~2–6             | ~1–3                        | ~1–3×          | |\n| Long (~128+ chars), cold          | 3–10              | 40–120           | 8–30                        | ~5–15×         | Vectorized wins big here |\n| 10,000 calls/sec (typical logging)| negligible        | \u003c0.5% total      | \u003c0.2% total                 | —              | Real apps: IO / crypto dominates |\n| In tight loop (1M iter/sec)       | —                 | 1–5% slowdown    | \u003c1% slowdown                | —              | Only if decrypt every iteration |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F00nx%2Fc-string-obfuscator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F00nx%2Fc-string-obfuscator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F00nx%2Fc-string-obfuscator/lists"}