Skip to content

Define canonical Merkle hash inputs and domain separation #19

Closed

Description

@Jenziner

Purpose

RWP uses a Merkle root to provide a cryptographically verifiable representation of a Case snapshot. For this to work across implementations and namespace boundaries, identical Record inputs must always produce the identical Merkle root.

The current specification defines the overall construction, but leaves essential details of the hash preimage ambiguous. This permits multiple reasonable implementations that nevertheless compute different roots over the same Case content.

This issue tracks the required normative clarification.

1. Define the canonical concatenation domain

The specification needs to state exactly which bytes are used when sibling values are combined and hashed.

In particular, it must resolve whether an implementation concatenates:

  • prefixed textual values, such as sha256:...;
  • bare hexadecimal strings;
  • decoded raw SHA-256 digests;
  • or another canonical representation.

The sorting rule must use the same defined representation. The specification should also state explicitly that concatenation is byte concatenation, not string concatenation.

Without this clarification, two conformant implementations may compute different Case roots and cannot verify each other's snapshots across namespace boundaries.

2. Add domain separation for leaves and internal nodes

The construction should distinguish cryptographically between a leaf hash and an internal-node hash.

The issue should define whether RWP adopts separate domain tags or prefixes for these two cases, following the established pattern used by Certificate Transparency / RFC 6962:

leaf     = H(leaf-domain-tag || record-digest)
internal = H(node-domain-tag || left-child || right-child)

The exact tags, the treatment of Record digests, and the interaction with the existing sorting and odd-element rules need to be decided normatively.

3. Preserve a single, explicit algorithm version

Both clarifications alter the Merkle roots produced by the current construction. They should therefore be decided together rather than introduced as separate future changes.

The resulting RWP text should specify:

  • the exact algorithm and hash function;
  • the byte-level input representation;
  • ordering and odd-element behaviour;
  • leaf and internal-node domain separation;
  • how the algorithm version is identified in a Case snapshot or related metadata;
  • the compatibility status of roots computed under earlier drafts.

Expected outcome

  • A single canonical Merkle-root algorithm in RWP.
  • Reproducible roots across independent implementations.
  • Test vectors covering at least one, two, three and several Record digests.
  • Cross-namespace verification under the rules of Chapter 12.
  • An explicit algorithm/version identifier or equivalent migration rule.

Initial direction for discussion

A possible direction is to operate on raw fixed-length digests, sort on the digest bytes, and apply distinct leaf and internal-node prefixes. This is not intended to pre-empt the detailed design discussion; the required outcome is one fully specified, byte-level canonical construction with interoperable test vectors.

Activity

  1. Jenziner commented on Aug 7, 2026

    @Jenziner
    ContributorAuthor

    Proposal

    RWP computes Merkle-tree inputs over raw SHA-256 digest bytes.
    Sibling order is determined lexicographically over those bytes.
    A leaf hash and an internal-node hash use distinct domain prefixes.
    All concatenation operations are byte concatenation operations.

  2. added
    CfC
    on Aug 7, 2026
  3. Jenziner commented on Aug 7, 2026

    @Jenziner
    ContributorAuthor

    This issue is part of the formal Call for Consensus (CfC) of the Community Group. Please see recordweb/.github#3 for the CfC scope, deadline (2026-08-21), and how to signal support/objection.

  4. Jenziner commented on Aug 24, 2026

    @Jenziner
    ContributorAuthor

    CfC#3 closed on 2026-08-21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CfCproposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions