For Japanese version, see ISemanticHasher-jp.md.
ISemanticHasher (Semantic Hash Interface Specification)
1. Responsibility Boundary
ISemanticHasher computes and verifies deterministic hash fingerprints representing canonical ROM semantics.
- Role:
- Non-role:
Produce algorithm-bound deterministic digests and verify digest equality against expected values.
Canonicalization itself is delegated to IRomCanonicalizer.
2. Contract Signature
namespace AIKernel.Abstractions.Rom;\n\npublic interface ISemanticHasher\n{\n string Algorithm { get; }\n\n string ComputeHash(CanonicalizedRomDto canonicalized);\n\n Task<string> ComputeHashAsync(CanonicalizedRomDto canonicalized, CancellationToken cancellationToken = default);\n\n bool VerifyHash(CanonicalizedRomDto canonicalized, string expectedHash);\n\n Task<bool> VerifyHashAsync(\n CanonicalizedRomDto canonicalized,\n string expectedHash,\n CancellationToken cancellationToken = default);\n}
3. Related Use Cases
UC-13Runtime signature verification and governance:UC-20Deterministic replay:UC-01ROM load validation:
Provides digest foundation for signature payload checks.
Enables fast semantic equivalence checks between runtime and stored ROM.
Supports integrity checks at ingestion.
4. Governance & Determinism
- Full determinism:
- Collision resistance:
- Algorithm consistency:
Same Algorithm + same CanonicalizedRomDto must yield identical hash text.
Implementations should use modern secure hash functions to reduce semantic-collision risk.
Behavior changes affecting persisted hashes require strict compatibility governance.
5. Exception Contract
This interface does not hard-code exception types. Implementations should clearly surface:
- Crypto subsystem failures:
- Unsupported algorithms:
Digest computation infrastructure errors.
Algorithm requested but unavailable in current runtime.
6. Implementation Notes
- Prefix format:
- Asset-chain integrity:
Prefer algorithm-tagged hash notation (e.g., sha256:...) for crypto agility.
Include referenced binary-asset digests in canonical payloads to preserve end-to-end integrity.
Changelog
- v0.0.0 / v0.0.0.0: Initial draft
- v0.0.1 (2026-05-06): Version upgrade aligned with documentation guidelines
architecture/interfaces/rom/ISemanticHasher.md