Download the PHP package nyra/bip39 without Composer
On this page you can find all versions of the php package nyra/bip39. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package bip39
Short Description An implementation of BIP-39 (Deterministic Mnemonic Code Words) in PHP
License MIT
Informations about the package bip39
BIP39 (Mnemonic code for generating deterministic keys)
PHP implementation of BIP-0039 supporting:
- Generate mnemonic (12–24 words) from secure random entropy
- Convert provided entropy (hex) to mnemonic
- Convert mnemonic back to original entropy (checksum verified)
- Derive seed (512-bit) from mnemonic + optional passphrase (PBKDF2-HMAC-SHA512 / 2048 rounds)
- Validate mnemonics
- All official BIP-39 wordlists (English, Chinese (Simplified & Traditional), Czech, French, Italian, Japanese, Korean, Portuguese, Spanish)
- Unicode NFKD normalization (when
ext-intlis available)
Installation
(For development / running tests clone the repo and run composer install.)
Optional: install ext-intl for full Unicode NFKD normalization; a graceful fallback is used if missing.
Usage
Multi-language Notes
- Pass the language identifier as the second argument to
generateMnemonic,entropyToMnemonic,mnemonicToEntropy,mnemonicToSeed, andmnemonicToSeedHex. - Language identifiers correspond to the
.txtfilenames inresources/wordlist/(without extension). - Japanese mnemonics are serialized with an ideographic space (U+3000) between words per BIP-39. This library:
- Uses the proper full-width space when generating Japanese mnemonics.
- Accepts input containing only ASCII spaces OR only full-width spaces, but rejects mixed usage to avoid ambiguous normalization.
- Normalizes ASCII spaces to the full-width separator internally.
- All other languages use a standard ASCII space.
API Summary
| Method | Description |
|---|---|
Bip39::generateMnemonic(int $entropyBits = 128, string $language = 'english') |
Secure random mnemonic (entropy bits: 128,160,192,224,256) in given language |
Bip39::entropyToMnemonic(string $entropyHex, string $language = 'english') |
Hex entropy to mnemonic |
Bip39::mnemonicToEntropy(string $mnemonic, string $language = 'english') |
Mnemonic back to entropy hex (validates checksum) |
Bip39::mnemonicToSeed(string $mnemonic, string $passphrase = '', string $lang='english') |
64-byte binary seed |
Bip39::mnemonicToSeedHex(string $mnemonic, string $passphrase = '', string $lang='english') |
Seed as hex |
Bip39::isValidMnemonic(string $mnemonic, string $language = 'english') |
Quick validation helper |
Bip39::languages(): array |
List of supported language identifiers |
Testing
Security Notes
- Only the checksum distinguishes valid from invalid mnemonics with same word count; always validate before using.
- A wrong passphrase yields a different (valid) seed (plausible deniability).
- Keep entropy and mnemonic generation on secure / trusted systems.
Normalization & Unicode
If ext-intl is installed, both mnemonic and passphrase are normalized with Unicode NFKD before seed derivation. This
ensures canonically equivalent sequences (e.g. composed vs decomposed accents) produce identical seeds.
License
MIT
Acknowledgements
Wordlists & reference vectors: Trezor team & BIP authors. This implementation reuses the publicly specified word lists ( MIT License).
All versions of bip39 with dependencies
ext-hash Version *
ext-mbstring Version *