Add error correction (ECW) support per BIP-93#4
Open
kiwihodl wants to merge 3 commits into
Open
Conversation
- Support both 128-bit (48 chars, 12 words) and 256-bit (74 chars, 24 words) seeds - Auto-detect seed size from codex32 string length - Box mode prompts user to select seed size upfront - Full-paste mode auto-detects from input Changes: - model.py: Add VALID_LENGTHS mapping, update parse/validate functions - controller.py: Add seed size selection for box mode - view.py: Add get_seed_size_choice(), update success display - tests/test_256bit.py: New test file with BIP-93 Vector 4 All existing 128-bit functionality preserved (backward compatible).
- Implement validated brute-force error correction - Support up to 4 substitution errors - Support up to 8 erasure errors (known positions) - User confirmation required before applying corrections - Add GF(32) field arithmetic module - Add comprehensive test suite (51 tests total) - Add .gitignore for Python artifacts New files: - src/gf32.py: GF(32) Galois Field arithmetic - src/error_correction.py: Error correction search - src/bch_decoder.py: BCH algorithms (reference) - tests/test_gf32.py: 18 field arithmetic tests - tests/test_correction.py: 22 edge case tests - tests/test_bch.py: BCH decoder tests Modified files: - src/model.py: Added try_correct_codex32_errors() - src/controller.py: Integrated correction into entry flow - src/view.py: Added correction UI functions - README.md: Documented ECW capability Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove redundant if/elif in seed_bytes_to_mnemonic (same fix as other PRs) - Remove unused VALID_LENGTHS import from controller - Add NOTE to bch_decoder.py explaining it's kept for future optimization - Improve test comment explaining search space calculation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements BIP-93 Error Correction Wallet (ECW) capability:
Implementation Approach
Uses validated brute-force search rather than raw BCH decoding:
New Files
src/gf32.pysrc/error_correction.pysrc/bch_decoder.pytests/test_gf32.pytests/test_correction.pytests/test_bch.pyTest Coverage
51 total tests covering:
Test Results
How to Test
🤖 Generated with Claude Code