CLAUDE.md 2.0 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build

cmake -B build -G "Visual Studio 17 2022" -A x64   # Windows (MSVC)
cmake -B build                                       # Linux / macOS
cmake --build build --config Release

No external dependencies — uses a built-in minimal JSON parser and custom RC4/crypto implementation.

Project overview

A cross-platform C++ software licensing utility with three commands:

Command Description
regInfo machinecode Print a 256-bit machine ID (SHA-256 of CPU + system disk)
regInfo generate -f <jsonfile> [outfile] Create an encrypted license file
regInfo read <licensefile> Decrypt and display license contents

The machine code combines CPUID brand string and system disk volume/device serial via SHA-256, formatted as 64 hex characters.

License files (*.xlts) use format: base64(MAGIC[4] + CRC32[4] + RC4_encrypted(JSON)). The RC4 key is embedded in src/license.cpp. Verification ties the license to the machine via the machinecode field stored in the encrypted JSON payload.

Architecture

src/
  main.cpp          — CLI dispatch (machinecode / generate / read)
  machine_code.cpp  — Platform-specific CPU + disk identification
  license.cpp       — License file encryption/decryption + validation
  crypto.cpp        — RC4 stream cipher, Base64, CRC32
  json_utils.cpp    — Minimal JSON parser (flat objects, string values only)

include/
  machine_code.h    — getMachineCode() → std::string
  license.h         — LicenseInfo struct, generateLicenseFile(), readLicenseFile()
  crypto.h          — rc4Crypt(), base64Encode/Decode(), crc32()
  json_utils.h      — JsonObject with parse/dump for string-only key/value pairs

Platform-specific #ifdef sections in machine_code.cpp cover Windows (CPUID, GetVolumeInformation, IOCTL_STORAGE_GET_DEVICE_NUMBER), Linux (/proc/cpuinfo, statfs), and macOS (sysctl, statfs).