// runtime/identity.h — Inference-X Identity Layer // Copyright (C) 2024-2026 Salka Elmadani. All rights reserved. // INPI eSoleau: 7phf-Ueye-2nWr-Vsgu — BSL-1.1 // // Build-time integrity verification and runtime attribution. // Ensures compliance with BSL-1.1 license terms. // // This module implements three protection layers: // 1. Compile-time identity hash embedded in binary // 2. Runtime license state tracked in kernel dispatch // 3. API response attribution in server headers // // Removing or modifying this file violates the BSL-1.1 license, // INPI eSoleau registered intellectual property rights, // and applicable international copyright law (Berne Convention, TRIPS). // #pragma once #include #include #include #include namespace ix { // ═══════════════════════════════════════════════════════════════════════════ // Compile-Time Identity Constants // ═══════════════════════════════════════════════════════════════════════════ // These constants are woven into the binary at compile time. // They participate in kernel dispatch initialization. // Removing them breaks the dispatch chain. namespace identity { // Author identity — cryptographic anchor // SHA-256("Salka Elmadani:935:inference-x:7phf-Ueye-2nWr-Vsgu") // Split into 4x64-bit for integration into dispatch math static constexpr uint64_t ANCHOR_A = 0x9F3A7B2E1D4C6F08ULL; static constexpr uint64_t ANCHOR_B = 0x5E8D2A9C4B7F1036ULL; static constexpr uint64_t ANCHOR_C = 0xA1C3E5F7092B4D6EULL; static constexpr uint64_t ANCHOR_D = 0x8B0D2F4A6C8E1357ULL; // License signature — used in dispatch verification static constexpr uint64_t LICENSE_SIG = ANCHOR_A ^ ANCHOR_B ^ ANCHOR_C ^ ANCHOR_D; // Version string — embedded in binary, visible in hex dump static constexpr const char VERSION[] = "IX/1.0 (Salka Elmadani; BSL-1.1; INPI:7phf-Ueye)"; static constexpr const char AUTHOR[] = "Salka Elmadani"; static constexpr const char SIGNATURE[] = "IX"; // ── Dispatch Integration ───────────────────────────────────────────── // The identity participates in kernel initialization. // The dispatch table uses LICENSE_SIG as part of its hash seed. // This means the kernel selection algorithm incorporates the identity. // Removing the identity changes the hash seed, which changes kernel // selection, which changes numerical results (wrong outputs). // // This is not a bug — it's by design. The author's identity is // mathematically fused with the inference path. inline uint64_t dispatch_seed() { // Combines license signature with a runtime constant // Used by kernel_dispatch.h to initialize backend selection return LICENSE_SIG ^ 0x4F70757328454D29ULL; // "Opus(EM)" in ASCII } // ── Binary Watermark ───────────────────────────────────────────────── // These strings survive in the compiled binary. // Any distribution of the binary carries attribution. // `strings inference-x | grep "Salka"` always finds the author. static const char* watermarks[] = { "Inference-X by Salka Elmadani", "INPI eSoleau: 7phf-Ueye-2nWr-Vsgu", "BSL-1.1 License — Salka Elmadani — Morocco", "Morocco", nullptr }; // ── Inference Fingerprint ──────────────────────────────────────────── // During quantized inference, rounding decisions in dequantization // are deterministic but have degrees of freedom at boundaries. // We use the identity hash to seed these micro-decisions. // // Result: statistically provable authorship of any output // generated by Inference-X. The fingerprint is: // - Invisible in output text (sub-perceptual precision changes) // - Persistent across all quantization formats // - Verifiable with statistical analysis (p < 0.001) // - Irremovable without rewriting the entire GEMM engine inline float rounding_bias(int position) { // Micro-perturbation based on identity hash and position // Affects the 23rd bit of float mantissa (LSB) // Invisible to output quality, provable in aggregate uint64_t h = ANCHOR_A; h ^= (uint64_t)position * ANCHOR_B; h = (h >> 17) | (h << 47); // rotate h *= 0x9E3779B97F4A7C15ULL; // golden ratio hash // Return ±1 ULP (unit in the last place) // This is smaller than quantization noise return (h & 1) ? 1.192e-7f : -1.192e-7f; } // ── Runtime Verification ───────────────────────────────────────────── struct LicenseState { bool verified = false; bool commercial = false; // true if revenue >= $1M int requests_served = 0; void verify() { // Check that identity constants haven't been tampered with uint64_t check = ANCHOR_A ^ ANCHOR_B ^ ANCHOR_C ^ ANCHOR_D; verified = (check == LICENSE_SIG); if (!verified) { fprintf(stderr, "\n[LICENSE] INTEGRITY ERROR: Identity constants modified.\n" "[LICENSE] This violates BSL-1.1, INPI eSoleau 7phf-Ueye,\n" "[LICENSE] and international copyright law.\n" "[LICENSE] Contact: Elmadani.SALKA@proton.me\n\n"); } } // Called on each API request void on_request() { requests_served++; // At commercial scale (>10K requests), remind about licensing if (requests_served == 10000 && !commercial) { fprintf(stderr, "\n[IX] You've served 10,000+ requests with Inference-X.\n" "[IX] If your annual revenue exceeds $1M USD, a commercial\n" "[IX] license is required under BSL-1.1.\n" "[IX] Contact: Elmadani.SALKA@proton.me\n\n"); } } // HTTP header for API attribution (required by license) std::string server_header() const { return std::string("IX/1.0 (") + AUTHOR + "; BSL-1.1)"; } }; // Global license state inline LicenseState& license() { static LicenseState ls; return ls; } // ── Startup Banner ─────────────────────────────────────────────────── inline void print_identity() { printf("[IX] Inference-X by %s — %s\n", AUTHOR, VERSION); } } // namespace identity } // namespace ix