SeedTools does not currently include a standalone utils/ directory.
Instead, utility functions are implemented inside the core modules:
bip32.pybip39.pybip44.pycrypto_core.pyeth_core.pytaproot.py
These utilities provide deterministic helper functions for:
- validation
- formatting
- encoding
- hashing
- zeroization
- byte‑level operations
They are pure, deterministic, side‑effect‑free, and fully compatible with Hardened Mode and the Memory Model.
Utility functions appear across the Core and support:
- BIP32 derivation
- BIP39 mnemonic processing
- BIP44 account derivation
- Bitcoin address generation
- Ethereum address generation
- Taproot key‑path derivation
Functional areas:
- validation
- formatting
- encoding
- hashing
- memory safety
validate_hex(value: str) -> None
Checks:
- valid hex characters
- even length
- no invalid prefixes
Raises: InvalidHexError
validate_mnemonic_words(words: list[str]) -> None
Checks:
- wordlist membership
- valid mnemonic length
validate_bip32_path(path: str) -> None
Checks:
- correct format
- hardened/not hardened markers
- index ranges
validate_entropy(entropy: bytes) -> None
Checks:
- length (128–256 bits)
- structure
- repetition patterns
normalize_hex(value: str) -> str
Returns:
- lowercase
- no spaces
- no
0xprefix
normalize_mnemonic(mnemonic: str) -> str
Returns:
- single‑space separation
- lowercase
- no special characters
normalize_path(path: str) -> str
Returns:
- deterministic BIP32 path format
- no redundant separators
hex_to_bytes(value: str) -> bytes
bytes_to_hex(data: bytes) -> str
base58_encode(data: bytes) -> str
base58_decode(value: str) -> bytes
bech32_encode(hrp: str, data: bytes) -> str
Used for:
- P2WPKH
- P2TR
sha256(data: bytes) -> bytes
ripemd160(data: bytes) -> bytes
hash160(data: bytes) -> bytes
hmac_sha512(key: bytes, data: bytes) -> bytes
keccak256(data: bytes) -> bytes
Used in Ethereum.
zeroize(buffer: bytearray) -> None
Securely overwrites a buffer with zeros.
secure_compare(a: bytes, b: bytes) -> bool
Constant‑time comparison.
secure_clear_list(values: list) -> None
Clears list contents in place.
int_to_bytes(value: int, length: int) -> bytes
bytes_to_int(data: bytes) -> int
ensure_bytes(value: Any) -> bytes
Converts:
- str → bytes
- bytearray → bytes
- int → bytes
Utils guarantee:
- deterministic behavior
- zeroization of sensitive buffers
- Hardened Mode compatibility
- no side effects
- no disk writes
- no OS‑dependent behavior
See: Hardened Mode.
Utils include:
- deterministic test vectors
- compatibility tests
- security tests
- zeroization tests
Run:
pytest -q
- Core API
- CLI API
- GUI API
- Security Guide
- Memory Model