Skip to main content

CanVouch

Every frame vouched for.

DBC-aware CAN bus CRC / rolling-counter verification for BLF, ASC, MF4 and TRC traces.

License: MIT Python CI

English | 🌍 中文


Web UI Verification result Self-contained HTML report
Web UI Verification result HTML report

Point it at a DBC and a captured trace. It finds the checksum and rolling-counter signals by name, computes the expected values with the configured algorithm, and reports every mismatch with a self-contained HTML report. No vehicle-specific code: signal-name patterns and DataID workbook layouts are configuration files.

The repository ships only synthetic example data.

🚀 30-second start

git clone https://github.com/zhaojiale2021/canvouch.git
cd canvouch
pip install -r requirements.txt

# Run the bundled example (CLI; no packaging step, no .exe)
python -m cli.main run -c examples/example/config.json -v

# Optional: install the `canvouch` command
pip install -e .
canvouch run -c examples/example/config.json -v
canvouch presets
canvouch inspect examples/example/dbc/network.dbc

Expected output: 160 frames, 320 checks, 100 % pass.

# Deliberately broken example → failures + RC error trends
python -m cli.main run -c examples/example/config_bad.json -v

Table output lists failures only by default; add --show-all to print every verdict. Use it as a gate: --fail-on-failure exits 1 on any failed check, and --min-pass-rate 99.5 exits 1 below the threshold (both also work on canvouch verify; the pre-rename crc-check command still works as an alias).

canvouch run -c examples/example/config.json --fail-on-failure

MF4/MDF traces need python-can's optional reader; requirements.txt already installs it. For a bare pip install -e ., add it with pip install "python-can[mf4]" (or pip install -e ".[mf4]").

Docker

docker build -t canvouch .
docker run --rm -p 8000:8000 canvouch

The image bundles the synthetic example project and serves the web UI on port 8000. Pushing a v* tag runs release.yml, which verifies the tag against crc_checker.__version__, runs the test suite, and publishes the wheel to PyPI and the image to GHCR (the PyPI trusted publisher must be configured once in the repository settings).

🌐 Web version

./run_web.sh 8000          # Windows: run_web.bat 8000
# http://127.0.0.1:8000

Two ways to run: pick a project id, or switch to manual mode and upload DBC file(s) + a trace (plus an optional DataID file), then fill in the config options (algorithm, range, DataID layout, filters) on the page. A project's bundled sample traces are one click away — no download-then-upload detour. The browser only sends project ids or uploaded files; paths stay server-side. Set CANVOUCH_API_TOKEN to require X-API-Token (or Authorization: Bearer) on every /api/* call; the value is entered in the UI's version dialog and kept in the browser's localStorage. Upload caps: 200 MB per file and 400 MB per request by default (CANVOUCH_MAX_UPLOAD_MB / CANVOUCH_MAX_REQUEST_MB). Projects are scanned from projects/ (or examples/ when projects/ does not exist; override with CANVOUCH_PROJECTS_DIR). The Vue frontend is committed as frontend/dist, so a deployment machine needs no Node. The launcher binds to 127.0.0.1 by default; set CANVOUCH_WEB_HOST or pass a host argument to opt into LAN binding. The web server has no authentication, so network exposure should be behind an authenticated reverse proxy or equivalent access controls. See docs/web-api.md.

Server environment variables use the CANVOUCH_ prefix (CANVOUCH_DATA_DIR, CANVOUCH_PROJECTS_DIR, CANVOUCH_API_TOKEN, CANVOUCH_MAX_UPLOAD_MB, CANVOUCH_MAX_REQUEST_MB); the pre-rename CRC_CHECKER_* / CRC_WEB_* names are still accepted as fallbacks.

🌟 What you get

When you need… What it does
Find protection signals automatically Prefix (Checksum_*, CRC_*) and suffix (*_CRC, *_Counter) naming, indexed E2E instances, sensor bus markers, block-counter exclusion — all driven by YAML regexes
Verify E2E profiles Profile 5 (CRC16/CCITT, DataID append, byte swap) and Profile 1/1A (CRC8/SAE-J1850-ZERO, DataID prepend, 4-bit counter)
Non-CRC checksums SUM8, SUM8/XOR-FF, XOR8/SEED, selected per message from DBC comments
Many trace formats BLF, ASC, MF4, TRC, CSV/LOG via python-can (MF4 via the python-can[mf4] extra)
Big traces Streaming verification, cached CRC engines, decimated RC trend charts, report size guard
CI gating --fail-on-failure / --min-pass-rate; the frame cap is never silent
DataID tables .xlsx, legacy .xls and preprocessed JSON; named column layouts from YAML
Reproducible results CLI and web share one runner (crc_checker/verify/runner.py)

🧮 Supported algorithms

Verified with real data means the algorithm reproduced expected values on captured CAN traces during development. Everything else is implemented and unit-tested against known-answer vectors, but not verified with real data — canvouch presets prints the same status.

Preset Use Status
CRC16/CCITT AUTOSAR E2E Profile 5 ✅ verified with real data
CRC8/SAE-J1850-ZERO AUTOSAR E2E Profile 1 / 1A ✅ verified with real data
CRC8/SAE-J1850 DBC-comment checksums ✅ verified with real data
SUM8/XOR-FF sum of bytes & 0xFF, then XOR 0xFF ✅ verified with real data
XOR8/SEED byte-wise XOR with a constant seed ✅ verified with real data
SUM8 plain additive sum & 0xFF ✅ verified (wider variants unverified)
CRC8/AUTOSAR, CRC8/H2F, CRC16/ARC, CRC16/MODBUS, CRC32/AUTOSAR, CRC32/ETHERNET, XOR8 — ⚠️ not verified with real data

Details and promotion checklist: docs/supported-algorithms.md.

🧩 Extending without code changes

New signal naming — add a regex to crc_checker/data/patterns.yaml:

checksum:
  prefix: ['(?i)^(checksum|check_sum|crc|e2e_crc)']
  suffix: ['(?i)(_crc|_checksum|_chks)([0-9_]*)$']
rolling_counter:
  prefix: ['(?i)^(rolling.?counter|rc_|alive.?counter)']
  suffix: ['(?i)(_counter|_cntr|_msgcntr)([0-9_]*)$']
  exclude: ['(?i)block_?counter']

Or point signals.patterns_file at your own YAML, or use signals.checksum_patterns / signals.rc_patterns inline.

New DataID workbook layout — add a named mapping to crc_checker/data/dataid_mappings.yaml, then select it with dataid.mapping. Use dataid.mapping_file for a separate file. Built-in names: hi_lo_two_cols, single_16bit, generic_abc, simple_8bit, description_regex.

New project — put config.json (+ DBC / DataID / trace) under projects/.

Generate a project config with an AI assistant

Copy this prompt and attach or provide the DBC, trace, and optional DataID files:

Create a CanVouch project configuration for my CAN data.

Please:
1. Identify the DBC file(s), trace file(s), and optional DataID Excel/JSON input.
2. Inspect the DBC protection signals and suggest a CRC preset, range, and DataID layout.
3. Produce `config.json` with paths, algorithm settings, frame filters, and HTML output.
4. Keep every input path relative to the generated config file.
5. Add comments explaining assumptions that need checking.
6. Validate the final JSON and report the exact `canvouch run -c <config> -v` command.

⚙️ Configuration

A run is a JSON file (canvouch gen-config writes an annotated example). The main sections:

Section Field Description
top level dbc / dbcs One DBC path, or a list of files/directories
dbc_merge Merge several DBCs into one map instead of selecting per trace channel
crc preset Preset name, or custom for inline parameters
byte_swap Swap computed CRC bytes (Profile 5)
auto_classify Pick the algorithm per message from DBC comments
profile_by_width 2-byte CRC → Profile 5, 1-byte → Profile 1
profiles Per-profile overrides (algorithm, DataID layout, range, counter max)
range_overrides / skip Per-message range / unverified signals
range mode exclude_crc / full_payload / custom_range
start_byte / end_byte Range for custom_range (-1 = end of payload)
dataid json / xlsx Preprocessed JSON (fast) or Excel workbook
mapping / mapping_file DataID column layout
position / byte_order / default prepend/append, lo_hi/hi_lo, fallback DataID
signals patterns_file Custom signal-name YAML
checksum_pattern(s) / rc_pattern(s) Regex overrides
filter frame_ids / max_frames CAN ID filter; frame cap (0 = unlimited, default 6000)
rc max_valid Max valid counter value (default 2^bits - 1)
output format / file / only_failures table or html, path, failures-only view
max_report_sections Frame-section cap (default 30 000, 0 = unlimited)

Full schema: crc_checker/config.py (CONFIG_SCHEMA_DOC). Editors can use config.schema.json for completion and validation ("$schema": "./config.schema.json" in your config file).

📁 Repository layout

crc_checker/            Core package
  crc/                  CRC engine, presets, E2E profiles, comment classifier
  dbc/                  DBC parser + signal resolver
  dataid/               DataID Excel/JSON parser
  trace/                Trace reader (BLF/ASC/MF4/TRC/CSV)
  protect/              CRC and rolling-counter verifiers
  verify/               Verification orchestration (shared by CLI and web)
  report/               Self-contained HTML report + RC trend charts
  data/                 Shipped pattern and DataID-mapping defaults
cli/                    Click CLI (python -m cli.main)
webapp/                 FastAPI backend
frontend/               Vue 3 + Element Plus (dist committed)
examples/               Synthetic example project + generator
tests/                  pytest suite

🧪 Development

pytest --tb=short --cov=crc_checker --cov=cli --cov=webapp \
  --cov-report=term --cov-fail-under=80          # CI backend test command
pylint $(git ls-files '*.py')                     # must stay 10.00/10
cd frontend && npm run lint                       # eslint
cd frontend && npm run format:check               # prettier
cd frontend && npm test                           # node --test (pure logic)
cd frontend && npm run test:component             # vitest (@vue/test-utils)
cd frontend && npm ci && npm run build            # rebuild committed dist
python examples/generate_example.py               # regenerate the example

CI runs pylint and coverage-gated pytest on Python 3.11, 3.12 and 3.13, plus a Windows pytest job and frontend lint/tests/build freshness checks. The pre-push hook runs pylint and the same 80%-coverage backend pytest command using Python 3.11 when uv is installed; otherwise it uses the active Python environment. It does not replace the full CI matrix or frontend checks.

🤝 Contributing

Issues and pull requests are welcome. Before opening a PR, run the development checks above; CI additionally covers the Python matrix, Windows, frontend checks, and committed-dist freshness.

📄 License

MIT. See LICENSE.


DBC in, trace in, verdicts out — no customer-specific code paths.

⭐ Star us on GitHub · 🐛 Report Issues

Metadata

Release files for canvouch 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for canvouch 0.2.1
File Size Uploaded Provenance Actions
canvouch-0.2.1.tar.gz 796.2 kB With provenance Details for canvouch-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for canvouch 0.2.1
File Interpreter ABI Platform Actions
canvouch-0.2.1-py3-none-any.whl Python 3 none any Details for canvouch-0.2.1-py3-none-any.whl

Total release size: 1.4 MB

Release files / canvouch-0.2.1.tar.gz

Download URL canvouch-0.2.1.tar.gz
Size 796.2 kB
Tags Source
SHA-256 checksum
How to use checksums
813e5b2995897da6b3c14a228b0da224543580a4ab71bc9645ebfeaf1612ea57
BLAKE2b-256 checksum
How to use checksums
89445f4d4d205a5740b2c94e015d84eb909f3b48ffb0352816ceffc8407b3636
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / canvouch-0.2.1-py3-none-any.whl

Download URL canvouch-0.2.1-py3-none-any.whl
Size 556.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1017a6f13bcdeba8c7f23bf97fdda94e0d276905d4e487b96de11c3dc5e48142
BLAKE2b-256 checksum
How to use checksums
b625d5eef5c3bbcaa19d9bfeaa2509f48d939e48a1e8426f2539292df49138f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for canvouch 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for canvouch-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page