{"id":15445345,"url":"https://github.com/jochasinga/keymaker","last_synced_at":"2025-07-08T19:42:53.309Z","repository":{"id":149002498,"uuid":"383701789","full_name":"jochasinga/keymaker","owner":"jochasinga","description":"BIP39 implementation of 128-bit Mnemonic seed generator.","archived":false,"fork":false,"pushed_at":"2021-11-26T22:26:31.000Z","size":52,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T08:33:08.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jochasinga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-07T06:49:13.000Z","updated_at":"2023-03-05T04:18:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"e53cbb91-12cc-46ea-8df6-4195258e51aa","html_url":"https://github.com/jochasinga/keymaker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jochasinga/keymaker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jochasinga%2Fkeymaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jochasinga%2Fkeymaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jochasinga%2Fkeymaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jochasinga%2Fkeymaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jochasinga","download_url":"https://codeload.github.com/jochasinga/keymaker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jochasinga%2Fkeymaker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261238910,"owners_count":23128882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T19:44:43.343Z","updated_at":"2025-07-08T19:42:53.288Z","avatar_url":"https://github.com/jochasinga.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keymaker\n\nHierarchical deterministic (HD) wallet library for crypto wallet.\n\n\n## structures\n\nThe project consists of the core modules named after the corresponding Bitcoin Improvement Proposals:\n\n- [bip39](src/bip39): Implementation of [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) 128-bit and 256-bit mnemonic seed generator.\n\n- [bip32](src/bip32): Implementation of [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) Hierarchical deterministic wallet.\n\n## BIP39\n\n128- to 256-bit mnemonic seed generator.\n\n### 1. Generate entropy\n\nGenerate entropy as a source of randomness. The entropy **must be a multiple of 32 bits** between\n128 to 256 bits. You should end up with a binary string of size *n* bits.\n\n```\n001001001011111000111100001111011011010101010000000111110000111000111011110011101000...\n```\n\n### 2. Entropy to mnemonic\n\nHash the entropy through SHA256, giving us a unique *fingerprint*. Then, take 1 lease significance bit (starting from left-hand side) of that hash *for every 32 bits of entropy*. So, that's 2 LSB for a 64-bit entropy, 3 LSB for a 96-bit entropy, and so on. Append those extra bits to the original entropy binary string.\nIf the original string was 128 bits, it will become 132 bits (128 + 4 extra bits from the hash of itself).\n\nNext, split up the entropy into groups of 11 bits (it should be equally divided by 11). Convert each group of 11-digit binary number to decimal number, and use it as an index to the [2048-word list](./wordlist.txt).\n\n### 3. Mnemonic to seed\n\nFinally, we can convert the mnemonic sentence (all mnemonic phrases concatenated into a single string) into a 64-byte random seed by using a password-hashing PBKDF2 function to hash the sentence several rounds, along with an optional passphrase as a salt (default salt is empty string \"\", prepended with the string \"mnemonic\"). Your mnemonic sentence is effectively your password.\n\nYou end up with the 64 random bytes as a seed for the [BIP32](#bip32) steps.\n\n## BIP32\n\nThis is an example of a 64 random byte string retrieved from the previous step:\n\n```\nb1680c7a6ea6ed5ac9bf3bc3b43869a4c77098e60195bae51a94159333820e125c3409b8c8d74b4489f28ce71b06799b1126c1d9620767c2dadf642cf787cf36\n```\n\n### 1. Master Extended Keys\nThe first step is to create the master keys. This is done by putting the 64 random bytes and an arbitrary key (default to string \"default_seed\") through the HMAC-SHA512 hash function.\n\nThis is passed in as the first `msg` parameter in `bip32::MasterExtendedKeys::new(msg: [u8; 64], key: Option\u003c\u0026str\u003e, ...)`.\n\nThe HMAC function returns a new 64 bytes data. **Split this into two halves to create the master keys**.\n\n- The left half is the **private key**.\n- The right half is the **chain code**, which is an extra 32 bytes of random data that is required to generate child keys.\n\nIf someone got hold of the private key but *not* the chain code, they wouldn't be able to derive the descendant keys (thereby protecting them).\n\n#### Extended Private Key\n\nWIP\n\n#### Extended Public Key\n\nWIP\n\n### 2. Extended Key Tree\n\nWIP\n\n- Normal\n- Hardened\n\n### 3. Child Extended Key Derivation\n\n#### 3.1 Normal Child `extended private key`\n\nWIP\n\n#### 3.2 Hardened Child `extended private key`\n\nWIP\n\n#### 3.3 Normal Child `extended public key`\n\nWIP\n\n#### 3.4 Hardened Child `extended public key`\n\nWIP\n\n### Serialization\n\nWIP\n\n\n\n\n\n\n\n### Resources:\n- [Mastering Bitcoin](https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch04.html#hd_wallets)\n- [learnmeabitcoin.com](https://learnmeabitcoin.com/technical/hd-wallets)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjochasinga%2Fkeymaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjochasinga%2Fkeymaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjochasinga%2Fkeymaker/lists"}