Skip to content

Spec: Appendix C trail-hash example may be illustrative — actual SHA-256 differs #18

@chrishooooo-netizen

Description

@chrishooooo-netizen

Summary

In §14.3 (Appendix C — Test Vectors), the org-mode example shows:

Hash input:       "acme:z3KMQXnVKR9qMzkJFfoo9WAYb1A7rdUbEkDCwNWTp6uJX"
SHA-256 (hex):    bd70674e4dff8c3a...
trail-hash:       "bd70674e4dff8c3a"
Output DID:       did:trail:org:acme-bd70674e4dff8c3a

The trailing ... suggests a truncated full digest. Computing SHA-256 of the documented hash input produces:

bd70674e4dffef6e1a54de8b4b78b9fe140f638dfc5b21a239eb48950cc60758

So the first 16 hex characters are bd70674e4dffef6e, not bd70674e4dff8c3a.

Verification

node -e "console.log(require('crypto').createHash('sha256').update('acme:z3KMQXnVKR9qMzkJFfoo9WAYb1A7rdUbEkDCwNWTp6uJX').digest('hex'))"
# bd70674e4dffef6e1a54de8b4b78b9fe140f638dfc5b21a239eb48950cc60758

Impact

Implementers building against this example as ground-truth will produce a different DID than the one written in the spec. §14.3 is the only normative test vector in v1.2.0 for the org-mode slug + trail-hash construction.

Suggested fix

Update §14.3 to the actual hash:

SHA-256 (hex):    bd70674e4dffef6e1a54de8b4b78b9fe140f638dfc5b21a239eb48950cc60758
trail-hash:       "bd70674e4dffef6e"
Output DID:       did:trail:org:acme-bd70674e4dffef6e

Refs

  • Spec: spec/did-method-trail-v1.md §14.3
  • Test vector using the actual hash: tests/conformance/did-creation/valid/02-org-mode-slug-hash.json
  • Conformance README "Spec-Versions Notes": tests/conformance/README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions