docs(spec): fix §10.2 Resource integrity hash — prefix is not r, not hashed
§10.2 step 3 wrongly equated the random-hash prefix prepended to the Resource body with the advertisement's `r` field, and step 5 fed that prefix into the hash/expected_proof input. Upstream RNS uses two distinct get_random_hash()[:4] values: a throwaway prefix the receiver strips and discards, and self.random_hash (the adv `r` field). The integrity hash is SHA256(uncompressed_plaintext || r) over the prefix-stripped, decompressed body — exactly as §10.8 already stated. - §10.2 steps 3 & 5 corrected to agree with §10.8 - §10.8: renamed misleading plaintext_with_random / data_with_random - §10.12: wire-layering block rewritten to match - README: errata entry under Spec corrections Verified against RNS 1.2.5 (Resource.py:332,405,412,440-443,682-694,755). Resolves #9. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
3eea25977a
commit
1b955d19a9
2 changed files with 18 additions and 11 deletions
|
|
@ -31,6 +31,9 @@ As content grows, `SPEC.md` will be split into per-layer files (packet header, i
|
|||
|
||||
Errata that may invalidate code built against an earlier revision of `SPEC.md`. Newest first. Feature additions and ordinary edits live in `git log` — this section is reserved for cases where the spec said one thing, that turned out to be wrong, and an implementer who pulled the bad version needs to fix their code.
|
||||
|
||||
- **2026-05-17 — §10.2 Resource integrity hash: the 4-byte prefix is NOT `r`, and is NOT in the hash input.**
|
||||
Bad text introduced in [`95823ad`](../../commit/95823ad); on master from 2026-05-03 to 2026-05-17. §10.2 step 3 wrongly equated the random-hash *prefix* prepended to the Resource body with the advertisement's `r` field, and step 5 wrongly fed that prefix into `hash`/`expected_proof` (claiming `hash = SHA256(random_hash || body || random_hash)`). Upstream `RNS/Resource.py` (1.2.4) uses *two distinct* `get_random_hash()[:4]` values: a throwaway prefix the receiver strips and discards (`:405`/`412`, `:682`), and `self.random_hash` — the advertisement's `r` field (`:440`, `:1285`). The integrity hash is `SHA256(uncompressed_plaintext || r)` over the prefix-stripped, decompressed body (`:441`, `:694`) — exactly as §10.8 already stated. An implementer who trusted §10.2 step 5 computes a hash no spec-compliant peer accepts; every Resource is rejected as `CORRUPT`. §10.2 corrected to agree with §10.8; §10.12's wire-layering block fixed to match. Surfaced by [issue #9](../../issues/9).
|
||||
|
||||
- **2026-05-06 — §2.1 flag byte: bit 7 is the IFAC flag, not part of `header_type`.**
|
||||
Bad text introduced in [`8c4d550`](../../commit/8c4d550), corrected in [`0c2021e`](../../commit/0c2021e); on master from 2026-05-04 to 2026-05-06. The corrected layout is `ifac_flag(bit 7) | header_type(bit 6) | context_flag(5) | transport_type(4) | destination_type(3-2) | packet_type(1-0)`, matching the official manual §4.6.3 and upstream `RNS/Packet.py:246` (parse mask `0b01000000 >> 6`) / `RNS/Transport.py:1003` (IFAC setter `raw[0] | 0x80`). Implementers who consumed the bad version will mis-parse every IFAC-protected packet as `header_type ∈ {2, 3}` and drop it. Surfaced by [issue #4](../../issues/4) item #1.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue