MoinMulla/anchor-provenance
⚓ Anchor — Video Provenance, Context-Integrity & Multi-Format DRM Platform
End-to-End Cryptographic Video Signing, Perceptual Context Alignment, Zero-Shot Neural Fact-Checking, Public Transparency Log (STH), and Multi-Format Ephemeral DRM Communication Engine.
     
🌐 Live Permanent 24/7 Demo
👉 Hugging Face Space: https://huggingface.co/spaces/MoinMulla/anchor-provenance 👉 Direct App URL: https://moinmulla-anchor-provenance.hf.space
📌 Executive Summary
Anchor is a production-hardened digital trust and media integrity platform designed to neutralize deepfakes, out-of-context clipping, unauthenticated viral misinformation, and confidential document leaks.
Anchor combines Deterministic Cryptography (Ed25519 digital signatures, SHA-256 Merkle Trees, fMP4 container embedding, Signed Tree Head CT logs, and AES-256-GCM AEAD encryption) with Perceptual & Neural AI (64-bit DCT perceptual frame hashing and HuggingFace BART-large-MNLI Zero-Shot Natural Language Inference).
┌────────────────────────────────────────────────────────┐
│ ANCHOR PLATFORM │
└───────────────────────────┬────────────────────────────┘
│
┌────────────────────────────────────────────────────┼────────────────────────────────────────────────────┐
│ │ │
┌────────┴────────┐ ┌────────┴────────┐ ┌────────┴────────┐
│ MODULE A │ │ MODULE B │ │ MODULE C │
│ Cryptographic │ │ Perceptual │ │ Multi-Format │
│ Provenance │ │ Context Matcher │ │ Secure DRM Hub │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
┌───────┴───────────────┐ ┌───────┴───────────────┐ ┌───────┴───────────────┐
│ • fMP4 Fragmentation │ │ • 1.0Hz DCT pHash │ │ • Multi-format AES-GCM│
│ • SHA-256 Merkle Tree │ │ • Sliding Hamming │ │ • PBKDF2 (600k iter) │
│ • Ed25519 Digital Sig │ │ Window Alignment │ │ • In-Browser DRM View │
│ • 'anch' MP4 Box Embed│ │ • Database Lookup │ │ • Public STH Ledger │
└───────────────────────┘ └───────────────────────┘ └───────────────────────┘🔬 How Anchor Works — Complete 12-Step Architecture
Step 1: Dynamic fMP4 Video Fragmentation
Videos are fragmented into 2.0-second GOP boundaries (Fragmented MP4 / fMP4) using ffprobe to detect exact native frame rates ($23.976$, $24.0$, $29.97$, $30.0$, $59.94$, $60.0$ FPS). This prevents algorithmic timing drift.
Step 2: SHA-256 Merkle Tree Construction
Anchor hashes each 2-second fragment payload using SHA-256. These fragment hashes become leaf nodes in a binary Merkle Tree. The root hash uniquely summarizes the entire video payload.
Step 3: Ed25519 Military-Grade Digital Signing
The Merkle root digest is signed using Ed25519 (Curve25519 high-speed elliptic curve digital signature algorithm). Public keys are registered in a thread-safe Root-of-Trust key registry (keys.json).
Step 4: Forensic License & Live GeoIP Spread Radar
Every signed media container attaches a cryptographic Forensic License ID (licenses.json) detailing territory access rights. Live requests evaluate client IP addresses via ipapi.co to flag out-of-territory distribution anomalies.
Step 5: Zero-Shot Neural Fact-Checking
Integrated HuggingFace facebook/bart-large-mnli Natural Language Inference (NLI) model parses claims and classifies statements into FALSE, TRUE, or UNVERIFIABLE with confidence ratings.
Step 6: Multi-Format Secure Communication Hub (AES-256-GCM)
Anchor encrypts all file types (Videos, PDFs, DOCX, XLSX, TXT, PNG, ZIP) into .ancr containers using AES-256-GCM authenticated encryption hardened with PBKDF2-HMAC-SHA512 (600,000 iterations).
Step 7: Dual Distribution Modes (Universal vs. Lockbox)
- Universal Mode: Signed video plays seamlessly in standard players (VLC, Windows Media Player, WhatsApp) while preserving tamper proofing.
- Lockbox Mode: Scrambles
mdatvideo payloads using AES-256-GCM, allowing playback only inside Anchor's trusted sandbox player.
Step 8: Custom anch ISOBMFF Box Embedding
The complete cryptographic manifest (Merkle root, Ed25519 signature, fragment map, license metadata) is serialized into a custom `anch` ISOBMFF atom box embedded directly inside the MP4 container.
Step 9: AI Perceptual Fingerprinting (64-bit DCT pHash)
Anchor extracts 64-bit Discrete Cosine Transform (DCT) perceptual image hashes at 1.0 Hz. A sliding-window Hamming distance matcher ($Threshold \le 12$) locates unauthenticated cropped snippets and aligns them to original broadcast timestamps.
Step 10: Zero-Trust DRM Sandbox Player & Watermark Overlay
Decrypted assets stream strictly as in-memory Blob URLs (URL.createObjectURL()) and are never written to disk. Category-aware rendering routes PDFs/DOCs to <iframe>, Text to <pre>, Images to <img>, and Videos to HTML5 <video> with active multi-corner session watermarks.
Step 11: Pinpoint Tampering Detection & 4-Strike Quarantine
If a single second of video is byte-altered, Anchor localizes the exact failure segment (e.g. Segment 3: 00:06 - 00:08), blocks playback, triggers a red flash alert, and seizes repeatedly tampered files into quarantine/.
Step 12: Public Transparency Log (Signed Tree Head / STH)
Every signed video generates a Signed Tree Head (STH) appended to an immutable append-only ledger (transparency_log.json / GET /transparency_log) formatted per RFC 6962 Certificate Transparency standards.
📁 Repository Directory Structure
video-provenance-system/
├── config.py # Centralized environment configuration
├── requirements.txt # Python dependencies
├── app.py # Hugging Face 24/7 entry point
├── Dockerfile # Container definition for HF Spaces / Cloud
├── .env.example # Environment variables template
├── .gitignore # Git exclusion rules
├── keys.json # Public key trust registry
├── fingerprints_db.json # Perceptual fingerprint database
├── transparency_log.json # Public Signed Tree Head (STH) transparency ledger
├── test_report.json # Automated test run results (41/41 passed)
├── Anchor_How_It_Works_Step_By_Step.pdf # 12-Step architectural PDF guide
├── Anchor_Technology_Stack_Architecture.pdf # PDF Technical specification
├── Anchor_Project_Execution_Guide.pdf # Comprehensive execution guide PDF
├── signer/ # Module A: Video Fragmentation & Ed25519 Signing
│ ├── fragment.py # fMP4 fragmentation with dynamic FPS detection
│ ├── sign.py # Merkle tree construction, Ed25519 signing, STH logging
│ └── keys/ # Encrypted PEM private signing keys
├── verifier/ # Module A: Verification & Box Locator
│ ├── verify.py # 5-step integrity verification pipeline
│ ├── locate.py # ISOBMFF box parser, AES-GCM payload encryption
│ └── trust_registry.py # Thread-safe Root-of-Trust key registry
├── fingerprint/ # Module B: Perceptual Hashing & Context Alignment
│ ├── extract.py # 1.0 Hz frame DCT pHash extraction
│ ├── database.py # Atomic JSON-backed fingerprint store
│ └── match.py # Sliding-window Hamming distance matcher
├── player/ # Module C: REST API & DRM Web Interface
│ ├── server.py # FastAPI server (15 active endpoints)
│ ├── secure_comm.py # Multi-format AES-256-GCM & PBKDF2 encryption engine
│ ├── fact_check.py # Zero-shot NLI claim verification pipeline
│ ├── licenses.json # Forensic license & territory database
│ └── static/
│ ├── index.html # Glassmorphism Dashboard & DRM Viewer
│ └── app.js # Client-side verification & Blob DRM player
├── tests/ # Comprehensive Test Suite
│ └── test_comprehensive.py # 41-vector automated test suite across 11 blocks
└── scripts/ # PDF Report Generation Scripts
├── generate_how_it_works_pdf.py # Builds Anchor_How_It_Works_Step_By_Step.pdf
├── generate_tech_stack_pdf.py # Builds Anchor_Technology_Stack_Architecture.pdf
└── generate_run_guide_pdf.py # Builds Anchor_Project_Execution_Guide.pdf🛠️ Quick Start Guide
1. Prerequisites
- Python 3.11 or higher
ffmpegandffprobeinstalled and added to system PATH
2. Installation
Clone the repository and install dependencies:
git clone https://github.com/moin08s/Anchor-Video-Provenance-System.git
cd Anchor-Video-Provenance-System
pip install -r requirements.txt3. Environment Setup
cp .env.example .env4. Run Comprehensive Automated Tests
python tests/test_comprehensive.pyExpected Output: TEST SUMMARY: 41/41 passed, 0 failed, 0 errors
5. Launch Dashboard Server
python player/server.pyOpen your browser and navigate to: [http://localhost:5000](http://localhost:5000)
📊 Algorithmic Complexity Benchmarks
🧪 Test Suite & Verification
The repository includes an extensive automated test runner (tests/test_comprehensive.py) validating 41 test vectors across 11 core function blocks:
================================================================================
TEST SUMMARY: 41/41 passed, 0 failed, 0 errors
================================================================================
--- SecureComm --- (10/10 PASS) Key gen, 5MB multi-chunk, wrong key, tamper GCM tag
--- MimeDetect --- (2/2 PASS) 8 MIME types, 7 file categories
--- MultiFormat --- (8/8 PASS) Roundtrip MP4, PDF, DOCX, TXT, JSON, PNG, XLSX, ZIP
--- FactCheck --- (5/5 PASS) Tampered FALSE, Unknown, Stripped, Live BART NLI
--- License --- (1/1 PASS) Forensic license validation
--- Signer --- (2/2 PASS) Fragment & Sign imports
--- Verifier --- (3/3 PASS) Verify pipeline, box locator, trust registry
--- Fingerprint --- (3/3 PASS) pHash extract, database lock, sliding matcher
--- Server --- (2/2 PASS) FastAPI init, 15 API routes registered
--- Config --- (3/3 PASS) Config, .env, .gitignore
--- Integration --- (2/2 PASS) Full SHA-256 integrity, 0.32s 1MB performance🌐 Hugging Face Space Synchronization
To push this repository directly to your Hugging Face Space:
git push hf main(When prompted for a password, enter your Hugging Face Access Token from [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)).
📄 License & Citation
Distributed under the MIT License. See LICENSE for details.
If you use Anchor in your research, please cite:
@misc{anchor2026provenance,
title={Anchor: End-to-End Cryptographic Video Provenance, Perceptual Context Alignment, and Ephemeral DRM Platform},
author={Moin et al.},
year={2026},
publisher={GitHub},
howpublished={\url{https://github.com/moin08s/Anchor-Video-Provenance-System}}
}