This crate provides a minimal implementation of the SWHID (SoftWare Hash IDentifier) format as defined in ISO/IEC 18670:2025 and detailed in the SWHID v1.2 specification.
This implementation is fully compliant with SWHID v1.2 and provides:
- Core identifier representation and parsing/printing (
swh:1:<tag>:<id>) - All SWHID v1.2 object types: contents (
cnt), directories (dir), revisions (rev), releases (rel), snapshots (snp) - Qualified identifiers (origin, visit, anchor, path, lines, bytes)
- SWHID v1.2 compliant hash computation for content and directory objects
- Optional VCS integration: computing
rev,rel,snpSWHIDs from Git (requiresgitfeature)
- Rust:
cargo install swhid(add--features gitfor VCS commands). - Binaries: Releases or Actions. Download for your OS/arch, extract, run (e.g.
./swhid --help). - More: User guide for all install options, library usage, examples, and CLI reference.
Library: Content::from_bytes(b"data").swhid() -> swh:1:cnt:<hex>. Parse with "swh:1:cnt:...".parse::<Swhid>().
CLI: swhid content --file README.md · swhid dir . · swhid parse "swh:1:cnt:..." · swhid verify PATH SWHID
See the user guide for full documentation.
Licensed under MIT.
- SWHID specification
- ISO/IEC 18670:2025 — Software Heritage Identifiers
- Software Heritage