Skip to content

Clarification on sort order  #11

@majestrate

Description

@majestrate

From § 9.1

Keyset ID = SHA-256(sorted pubkeys).

sorted how? lexigraphical? merkle tree? also which direction? ascending? descending?

Activity

slammingprogramming

slammingprogramming commented on Aug 11, 2025

@slammingprogramming

The specification states:

Keyset ID = SHA-256(sorted pubkeys).

To clarify the sorting method:
• The sorting is lexicographical ascending order based on the raw byte representation of each public key.
• This means each public key is treated as a byte string and sorted from lowest to highest byte value, byte-by-byte.
• No Merkle tree or other data structure is involved in the sorting itself; the pubkeys are simply sorted as a list before concatenation and hashing.
• After sorting, the pubkeys are concatenated in that order, and the SHA-256 hash is computed over the entire concatenated byte sequence to produce the Keyset ID.

If the spec text doesn’t explicitly say this, it might be worth adding a short normative clarification for implementers.

Also, this is at least my own interpretation. I may be mistaken and am open to feedback on this.

TotallyNotK0

TotallyNotK0 commented on Aug 13, 2025

@TotallyNotK0
Member

This is something we need to work on. The current spec doesn't specify the sort, that's a gap. I'll get on it.

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @majestrate@TotallyNotK0@slammingprogramming

        Issue actions

          Clarification on sort order · Issue #11 · ravendevteam/betanet