Repository navigation
bip93: Check share sets in codex32_interpolate and add invalid set vectors - #5
BenWestgate wants to merge 5 commits into
Conversation
List valid codex32 strings that do not form a valid set of shares: Test vector 2's share C with a different human-readable part, threshold or identifier, or with share A's index, paired with share A, and two shares of Test vector 3 (fewer than its threshold). codex32_recover returns a valid codex32 secret for the different-identifier set and the Test vector 3 pair, so only the set checks catch them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
|
||
| The shares of Test vector 3 with indexes <code>a</code> and <code>c</code> do not form a valid set, because there are fewer of them than the threshold. | ||
|
|
||
| Given the set with different identifiers, or these two shares of Test vector 3, <code>codex32_recover</code> returns a valid codex32 secret. |
There was a problem hiding this comment.
This PR needs to include a set-validation helper so these can actually fail.
There was a problem hiding this comment.
Added codex32_check_set(strings, x) in 64510b1. It takes strings so the HRP check works, and it returns false for every set here with target s.
Generated by Claude Code
Add codex32_check_set, which takes valid codex32 strings and a target share index and checks the conditions on the inputs to codex32_interpolate. It takes strings because the data-part representation omits the human-readable part. Point the MUST-check sentence at it, and note that it rejects each invalid share set vector. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK
Make codex32_interpolate take codex32 strings and a target index character, check the set with codex32_check_set, and return a string. Strings keep the human-readable part, which the data-part representation dropped. codex32_recover now raises an error for every invalid share set vector, so the MUST-check sentence goes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK
Add a generic codex32_decode that applies the string rules for any human-readable part: case, character set, HRP length, checksum, minimum length and header. codex32_interpolate now decodes each input before checking the set, so strings with bad checksums are rejected, and codex32_check_set also requires the target to be one bech32 character. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK
Return the interpolated string in uppercase when every input is uppercase, and in lowercase otherwise, so Test vector 2's uppercase shares give its uppercase derived share and secret. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK
Requested by Ben · project thread
Add invalid share set test vectors to BIP93 for bitcoin#2320, as discussed in stutxo/codex32_lean#1, and make the reference code reject them.
codex32_decode(s)applies the string rules for any HRP and returns the HRP and data part, orNone.codex32_interpolate(strings, x)takes codex32 strings and a target index character, decodes each string, checks the set withcodex32_check_set, and returns a string. It raises an error for an invalid string or set.Each vector set is made of valid strings but is not a valid set of shares:
codex32_recoverraises an error for all of them. Without the check, interpolation returns a valid secret for the identifier set and the test vector 3 pair.🤖 Generated with Claude Code
https://claude.ai/code/session_01DNycZ6NQBfYLvTVtgeZWxK