Skip to content

Add sha256shi0 deterministic transform #27

Description

@oritwoen

Problem

Simple hash-based deterministic key derivation scheme useful for research:

seed_hash = SHA256(seed).hex()
k_i = SHA256(f"{seed_hash}:{i}:0") % n

The name sha256shi0 encodes the format: sha256 hash : index : 0

Algorithm

def sha256shi0(seed: bytes, index: int, chain: int = 0) -> int:
    seed_hash_hex = hashlib.sha256(seed).hexdigest()
    payload = f"{seed_hash_hex}:{index}:{chain}"
    key = hashlib.sha256(payload.encode()).digest()
    return int.from_bytes(key, "big") % SECP256K1_ORDER

Key Characteristics

  • No stretching: Direct SHA256 of seed
  • Single SHA256: Simple hash of formatted string
  • Format: "{seed_hash_hex}:{index}:{chain}"
  • Fast: No iterations, suitable for brute-force scanning

Proposed Solution

# Generate keys using sha256shi0
vuke generate --transform sha256shi0 wordlist --file seeds.txt

# With change chain (1 instead of 0)
vuke generate --transform sha256shi0:change wordlist --file seeds.txt

Implementation

pub struct Sha256Shi0Transform {
    chain: u8,  // 0 = external (default), 1 = internal
}

impl Sha256Shi0Transform {
    fn derive(&self, seed: &[u8], index: u32) -> [u8; 32] {
        let seed_hash_hex = hex::encode(sha256(seed));
        let payload = format!("{}:{}:{}", seed_hash_hex, index, self.chain);
        sha256(payload.as_bytes())
    }
}

Use Cases

  • Research on simple deterministic schemes
  • Fast scanning of candidate seeds
  • Testing hypotheses about unknown wallet formats

Priority

Low - this is not a known historical vulnerability, but a research tool pattern.

References

  • Pattern used in cryptopuzzles research: puzzles/saatoshi_rising/analysis/electrum_search.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions