seqhash

package
v0.13.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package seqhash provides the hash function used to compute HashKey values in BRC-124/BRC-128 frames.

HashKey is a stable per-flow identifier computed by the proxy as:

XXH64(senderIPv6 ∥ groupIdx ∥ subtreeID)

where senderIPv6 is the 16-byte IPv6 address of the frame sender, groupIdx is the 4-byte big-endian multicast group index, and subtreeID is the 32-byte BRC-124 subtree identifier (zero when unset).

HashKey is the same value for every frame in a (sender, group, subtree) flow. Gap detection uses a separate monotonic SeqNum counter; HashKey provides per-flow identity for cache lookup and NACK dispatch.

Including subtreeID in the hash input keeps every subtree on its own independent flow even within a single shard group (BRC-124 §1.2).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(senderIPv6 [16]byte, groupIdx uint32, subtreeID [32]byte) uint64

Hash computes the stable per-flow XXH64 identifier (HashKey).

  • senderIPv6: 16-byte IPv6 address of the originating sender (as returned by net.IP.To16()).
  • groupIdx: multicast group index for this frame's TxID shard.
  • subtreeID: 32-byte BRC-124 subtree identifier; all-zero when unset.

The returned value is identical for every frame in the same (sender, group, subtree) flow. A separate monotonic SeqNum counter provides per-frame ordering; HashKey is never zero in practice (the probability of XXH64 collision is negligible at any realistic flow count).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL