docxology/steganographer

GitHub: docxology/steganographer

这是一款用 Rust 编写的实时视频与音频隐写工具,通过加密签名和可见水印为媒体流提供防篡改验证与来源追溯能力。

Stars: 1 | Forks: 0

Steganographer Dashboard

🔒 Steganographer

用于视频和音频的实时加密水印 —— 完全使用 Rust 构建

入门指南架构密码学CLI 参考常见问题

Rust Tests MIT 4 crates

Steganographer 使用 LSB 隐写术、QR 码覆盖层和 GStreamer pipeline,将**加密签名**(BLAKE3 + Ed25519)和**可见水印**嵌入到实时媒体流中。每一帧视频和音频块都会进行实时的哈希计算、签名和验证。
📹 Dashboard Demo — click to expand
Dashboard Demo
The three-tab dashboard: Video encoding/verification, Audio steganography, and in-app Documentation viewer.
## ⚡ 快速开始 ``` git clone https://github.com/docxology/steganographer.git cd steganographer cargo build --workspace cargo test --workspace # 187 tests, 0 failures ./run.sh # Interactive terminal menu ``` ## 🏗️ 工作原理 ``` Raw Frame/Audio → BLAKE3 Hash → Ed25519 Sign → LSB Embed → QR Overlay ↓ ↓ Tamper-evident media Visible provenance ``` 每一帧都会经过一个**四阶段 pipeline**: 1. **哈希** — [BLAKE3](docs/cryptography.md#blake3-hashing) 对 `frame_index ∥ video_bytes ∥ audio_bytes` 计算 256 位摘要 2. **签名** — [Ed25519 或 Ethereum/secp256k1](docs/cryptography.md#ed25519-signing) 对哈希进行签名以检测篡改 3. **嵌入** — [LSB 隐写术](docs/algorithms.md#lsb-video-protocol) 将 109 字节的 payload 隐藏在像素/采样的最低有效位中 4. **覆盖** — [QR 码 + 文本水印](docs/algorithms.md#qr--info-bar-overlay) 将可见的出处信息烙印在帧中 ## 🖥️ 实时仪表板 一个包含三个选项卡的 Web GUI,用于实时的往返验证: | 选项卡 | 功能 | | ----- | ------------- | | **Video** | 摄像头 → LSB 编码 → 解码 → 验证(实时)。可控制不透明度、LSB 位数、签名频率、QR 缩放比例和分辨率 | | **Audio** | 麦克风 → PCM 采集 → LSB 嵌入 → 提取 → 验证。包含波形和频谱可视化,支持 WAV 录音 | | **Docs** | 在仪表板内浏览所有 17 份项目文档,支持搜索和导航 |
🔽 Dashboard screenshots
Video Tab Audio Tab
Video: encode + verify + config Audio: waveform + LSB verification
Docs Tab QR Overlay
Docs: in-dashboard documentation QR overlay with timestamp
``` # 启动 Dashboard ./run.sh # select 'd' for dashboard, or 'a' for all # 或直接: cargo run -p steganographer-cli -- dashboard --port 8080 --backend ed25519 ``` ## 🧩 架构 四个具有严格依赖分层关系的 Rust crate: ``` ┌──────────────────────────────────────────────┐ │ steganographer-cli (binary) │ Clap CLI: 8 subcommands ├──────────────────────────────────────────────┤ │ steganographer-dashboard (web server) │ Axum + WebSocket, 3 tabs │ steganographer-gst (GStreamer plugin) │ AppSink/AppSrc pipeline ├──────────────────────────────────────────────┤ │ steganographer-core (algorithms) │ Pure Rust, 0 system deps └──────────────────────────────────────────────┘ ``` | Crate | 用途 | 测试 | 文档 | | ------- | --------- | ------- | ------ | | **[steganographer-core](steganographer-core/)** | 密码学、LSB、DCT、扩频、加密、纠错、多帧、覆盖层、配置 | 174 | [架构](docs/architecture.md) | | **[steganographer-dashboard](steganographer-dashboard/)** | 实时 Web GUI | 12 | [API 参考](docs/api-reference.md) | | **[steganographer-gst](steganographer-gst/)** | GStreamer 集成 | 1 | [GStreamer 指南](docs/gstreamer.md) | | **[steganographer-cli](steganographer-cli/)** | CLI 可执行文件 | 0 | [CLI 参考](docs/cli-reference.md) | ## 🔑 密码学设计 | 组件 | 算法 | 详情 | | ----------- | ----------- | --------- | | **哈希计算** | BLAKE3 / SHA-256 / SHA-3 | 可配置;默认使用 BLAKE3,对 `frame_index ∥ video_bytes ∥ audio_bytes` 计算 256 位摘要 | | **签名** | Ed25519 | 对哈希值生成 64 字节且满足 EUF-CMA 安全性的签名 | | **Payload** | 104 字节 | `frame_index (8) + hash (32) + signature (64)` | | **视频嵌入** | 带长度前缀的 LSB | 带 32 位长度头部的 1–4 位替换 | | **音频嵌入** | 带密钥的 ChaCha8 PRNG | 伪随机采样排列,用于分散嵌入 | | **加密** | ChaCha20-Poly1305 | 在嵌入前对 payload 进行 AEAD 加密以确保机密性 | | **纠错** | Reed-Solomon GF(2⁸) | 从损坏的位中恢复 payload | | **备选视频嵌入** | DCT 域 | 中频系数嵌入,增强抗压缩能力 | | **备选视频嵌入** | 扩频 | PN 序列调制,增强抗噪能力 | | **多帧** | 分片传播 | 一个签名分散在 N 个帧中,增强对部分丢失的抵御能力 | | **备选签名** | Ethereum secp256k1 | EIP-191 personal_sign,兼容 MetaMask | ## 🛠️ CLI 用法 ``` # 生成密钥对 steganographer keygen --output mykey # 离线编码 steganographer encode --input frame.rgb --output signed.rgb --stego-type lsb_video --bits 1 # 报告文件的隐写容量 steganographer info --input frame.rgb --stego-type lsb_video --bits 1 # 验证 steganographer verify --input signed.rgb --public-key --stego-type lsb_video --format json # 验证 TOML 配置文件 steganographer config check # 实时视频 (GStreamer) steganographer video --config steganographer.toml # 实时音频 steganographer audio --config steganographer.toml # Dashboard steganographer dashboard --port 8080 --backend ed25519 ``` ## ⚙️ 配置 两份包含完整说明的配置文件: - [`steganographer.toml`](steganographer.toml) — 主配置文件(视频/音频源、签名密钥、隐写模块) - [`config/example.toml`](config/example.toml) — 包含详细注释的最小化示例 ``` [video] source = "avfvideosrc" width = 1280 height = 720 [signing] backend = "ed25519" [[stego.modules]] type = "lsb_video" bits = 2 ``` ## ✅ 测试 跨 4 个 crate 共有 187 个测试 —— 全部通过: | 类别 | 数量 | 位置 | | ---------- | ------- | ---------- | | Core 单元测试 | 115 | `steganographer-core/src/*.rs` | | Core 集成测试 | 59 | `steganographer-core/tests/integration_tests.rs` | | Dashboard 测试 | 12 | `steganographer-dashboard/tests/dashboard_tests.rs` | | GStreamer + Ethereum | 1 + 0 | 插件骨架 + feature-gated 控制(无内联测试) | | **总计** | **187** | **0 失败** | ``` cargo test --workspace # All 187 tests cargo test -p steganographer-core # Core only (174 tests) cargo test -p steganographer-dashboard # Dashboard only (12 tests) ``` ## 🌍 平台支持 | 平台 | 视频源 | 音频源 | 文档 | | ---------- | ------------- | ------------- | ------ | | **macOS** | `avfvideosrc` | `osxaudiosrc` | [平台](docs/platforms.md) | | **Linux** | `v4l2src` | `pulsesrc` / `pipewiresrc` | [平台](docs/platforms.md) | | **Docker** | Headless | Headless | [平台](docs/platforms.md) | ## 📚 文档 [`docs/`](docs/) 目录下包含 17 份详尽的指南: | 指南 | 描述 | | ------- | ------------- | | [**入门指南**](docs/getting-started.md) | 前置条件、构建和首次运行教程 | | [**架构**](docs/architecture.md) | Crate 层次结构、模块图、数据流 | | [**密码学**](docs/cryptography.md) | BLAKE3、Ed25519、Ethereum 签名 | | [**算法**](docs/algorithms.md) | LSB 协议、容量计算、QR 覆盖层 | | [**隐写术理论**](docs/steganography-theory.md) | 信息论安全基础 | | [**安全性**](docs/security.md) | Cachin 的 ε-security 理论、部署指南 | | [**威胁模型**](docs/threat-model.md) | 对手模型、攻击目录、缓解措施 | | [**CLI 参考**](docs/cli-reference.md) | 全部 6 个命令及示例 | | [**API 参考**](docs/api-reference.md) | HTTP + WebSocket endpoint、JSON schema | | [**配置**](docs/configuration.md) | 完整的 TOML schema、模板变量 | | [**GStreamer**](docs/gstreamer.md) | Pipeline 集成、AppSink/AppSrc | | [**平台**](docs/platforms.md) | macOS、Linux、Docker 环境配置 | | [**贡献指南**](docs/contributing.md) | 开发工作流、测试、PR 检查清单 | | [**路线图**](docs/roadmap.md) | DCT 域、ML-DSA、后量子计划 | | [**常见问题**](docs/faq.md) | 30 多个问答 | ## 📄 许可证 MIT — 详情请参阅 [LICENSE](LICENSE)。
标签:GStreamer, Rust, 信息隐藏, 可视化界面, 密码学, 手动系统调用, 数字水印, 网络流量审计, 通知系统, 音视频处理