Skip to content

feat: SHA-256 self-integrity verification (Python + C++)#11

Open
writsop wants to merge 1 commit intojavelin-anticheat:mainfrom
writsop:feat/sha256-integrity
Open

feat: SHA-256 self-integrity verification (Python + C++)#11
writsop wants to merge 1 commit intojavelin-anticheat:mainfrom
writsop:feat/sha256-integrity

Conversation

@writsop
Copy link
Copy Markdown

@writsop writsop commented Mar 1, 2026

Summary

Adds SHA-256 self-integrity verification to Javelin Anti-Cheat, complementing the existing CRC32 check. Includes a standalone Python implementation with full test suite.

Closes #4

Changes

AntiCheat.cpp (C++)

  • Added zero-dependency SHA-256 implementation (RFC 6234 compliant)
  • New checkSelfIntegritySHA256() function alongside existing CRC32
  • Build-time constant JAVELIN_EXPECTED_SHA256 for baking hash into binary
  • --compute-hash CLI flag to output both CRC32 and SHA-256 of the binary
  • No new external dependencies

integrity_check.py (Python)

  • Standalone SHA-256 integrity verification script
  • Uses JAVELIN_EXPECTED_SHA256 env var for expected hash
  • --compute-hash utility mode
  • Graceful skip when env var not set (dev-friendly)
  • Programmatic API: verify_integrity() and compute_file_sha256()

tests/test_integrity.py

  • 11 unit tests, all passing
  • Covers: known content hashing, empty files, large files (1MB), missing files, hash matching, mismatch detection, case insensitivity, whitespace handling, tamper detection

README.md

  • Complete rewrite with feature matrix, quick start guides for both C++ and Python, architecture explanation, security notes

Testing

Ran 11 tests in 0.011s
OK

All tests pass on Python 3.10+. C++ compiles with MSVC and MinGW (Windows-only due to WinAPI dependencies).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add Integrity Verification (Hash of Executable/Script)

1 participant