Skip to content

Add 256-bit seed support#3

Open
kiwihodl wants to merge 3 commits into
FractalEncrypt:masterfrom
kiwihodl:256bit-seed-support
Open

Add 256-bit seed support#3
kiwihodl wants to merge 3 commits into
FractalEncrypt:masterfrom
kiwihodl:256bit-seed-support

Conversation

@kiwihodl

Copy link
Copy Markdown

Summary

Adds support for 256-bit seeds (74-character codex32 strings → 24-word BIP39 mnemonics).

Seed Size Codex32 Length BIP39 Output
128-bit 48 characters 12 words
256-bit 74 characters 24 words

Changes

  • model.py: Auto-detect seed size from string length
  • controller.py: Box mode prompts for seed size selection
  • view.py: Updated prompts and success display
  • tests/test_256bit.py: New test file with BIP-93 Test Vector 4

How It Works

  • Full-paste mode: Auto-detects from input length (48 or 74 chars)
  • Box-by-box mode: Prompts user to select 128-bit or 256-bit at start

Test Output

test_256bit_to_mnemonic: PASS (24 words)
  Mnemonic: zoo ivory industry jar praise service talk skirt during october lounge acid year humble cream inspire office dry sunset pride drip much dune arm
test_128bit_still_works: PASS (12 words)

All existing 128-bit functionality preserved (backward compatible).

- 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).
@kiwihodl kiwihodl force-pushed the 256bit-seed-support branch from d901d7d to 510ecc7 Compare January 31, 2026 22:02
kiwihodl and others added 2 commits February 1, 2026 11:25
- test_256bit_invalid_checksum_rejected: Verifies checksum validation
- test_256bit_single_char_corruption: Tests corruption detection at 5 positions
- test_73_char_length_rejected: Boundary test (one char short)
- test_75_char_length_rejected: Boundary test (one char long)
- test_mnemonic_words_are_valid_bip39: Verifies all words are valid BIP39

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove redundant if/elif branches in seed_bytes_to_mnemonic
- Remove unused VALID_LENGTHS import from controller
- Move bip39 import to module level in test file
- Add expected mnemonic to VECTOR4 for stronger test validation
- Add comments explaining magic numbers and position tests
- Add .gitignore for Python artifacts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant