|
3 | 3 | Layer: Applications |
4 | 4 | Title: Deterministic Entropy From BIP32 Keychains |
5 | 5 | Author: Ethan Kosakovsky < [email protected]> |
| 6 | + |
6 | 7 | Comments-Summary: No comments yet. |
7 | 8 | Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0085 |
8 | 9 | Status: Draft |
@@ -51,6 +52,9 @@ For each application that requires its own wallet, a unique private key is deriv |
51 | 52 |
|
52 | 53 | The HMAC-SHA512 function is specified in [http://tools.ietf.org/html/rfc4231 RFC 4231]. |
53 | 54 |
|
| 55 | +Application codes may be arbitrary but are preferably semantic in some way, such as a BIP number or |
| 56 | +ASCII character code sequence. |
| 57 | + |
54 | 58 | ===Test vectors=== |
55 | 59 |
|
56 | 60 | ====Test case 1==== |
@@ -78,7 +82,7 @@ BIP85-DRNG-SHAKE256 is a deterministic random number generator for cryptographic |
78 | 82 | RSA key generation is an example of a function that requires orders of magnitude more than 64 bytes of random input. Further, it is not possible to precalculate the amount of random input required until the function has completed. |
79 | 83 |
|
80 | 84 | drng_reader = BIP85DRNG.new(bip85_entropy) |
81 | | - rsa_key = RSA.generate_key(4096, drng_reader.read()) |
| 85 | + rsa_key = RSA.generate_key(4096, drng_reader.read) |
82 | 86 |
|
83 | 87 | ===Test Vectors=== |
84 | 88 | INPUT: |
|
93 | 97 |
|
94 | 98 | ==Reference Implementation== |
95 | 99 |
|
96 | | -* Python library implementation: [https://github.com/ethankosakovsky/bip85] |
| 100 | +* Python 3.x library implementation: [https://github.com/akarve/bipsea] |
| 101 | +* Python 2.x library implementation: [https://github.com/ethankosakovsky/bip85] |
97 | 102 | * JavaScript library implementation: [https://github.com/hoganri/bip85-js] |
98 | 103 |
|
99 | 104 | ==Applications== |
@@ -143,6 +148,10 @@ Language Table |
143 | 148 | |- |
144 | 149 | | Czech |
145 | 150 | | 8' |
| 151 | +|- |
| 152 | +| Portuguese |
| 153 | +| 9' |
| 154 | +|- |
146 | 155 | |} |
147 | 156 |
|
148 | 157 | Words Table |
@@ -224,6 +233,10 @@ Application number: 32' |
224 | 233 |
|
225 | 234 | Taking 64 bytes of the HMAC digest, the first 32 bytes are the chain code, and second 32 bytes[1] are the private key for BIP32 XPRV value. Child number, depth, and parent fingerprint are forced to zero. |
226 | 235 |
|
| 236 | +WARNING: The above is inconsistent with BIP32 which uses the first 32 bytes for the private key. |
| 237 | + |
| 238 | +Applications may support Testnet by emitting TPRV keys if and only if the input root key is a Testnet key. |
| 239 | + |
227 | 240 | Path format is <code>m/83696968'/32'/{index}'</code> |
228 | 241 |
|
229 | 242 | INPUT: |
@@ -257,7 +270,7 @@ The derivation path format is: <code>m/83696968'/707764'/{pwd_len}'/{index}'</co |
257 | 270 |
|
258 | 271 | `20 <= pwd_len <= 86` |
259 | 272 |
|
260 | | -[https://datatracker.ietf.org/doc/html/rfc4648 Base64] encode the all 64 bytes of entropy. |
| 273 | +[https://datatracker.ietf.org/doc/html/rfc4648 Base64] encode all 64 bytes of entropy. |
261 | 274 | Remove any spaces or new lines inserted by Base64 encoding process. Slice base64 result string |
262 | 275 | on index 0 to `pwd_len`. This slice is the password. As `pwd_len` is limited to 86, passwords will not contain padding. |
263 | 276 |
|
@@ -356,6 +369,39 @@ GPG capable smart-cards SHOULD be loaded as follows: The encryption slot SHOULD |
356 | 369 |
|
357 | 370 | However, depending on available slots on the smart-card, and preferred policy, the CERTIFY capable key MAY be flagged with CERTIFY and SIGNATURE capabilities and loaded into the SIGNATURE capable slot (for example where the smart-card has only three slots and the CERTIFY capability is required on the same card). In this case, the SIGNATURE capable sub-key would be disregarded because the CERTIFY capable key serves a dual purpose. |
358 | 371 |
|
| 372 | +===DICE=== |
| 373 | + |
| 374 | +Application number: 89101' |
| 375 | + |
| 376 | +The derivation path format is: <code>m/83696968'/89101'/{sides}'/{rolls}'/{index}'</code> |
| 377 | + |
| 378 | + 2 <= sides <= 2^32 - 1 |
| 379 | + 1 <= rolls <= 2^32 - 1 |
| 380 | +
|
| 381 | +Use this application to generate PIN numbers or any other numeric secret. |
| 382 | +Roll values are zero-indexed, such that an N-sided die produces values in the range |
| 383 | +<code>[0, N-1]</code>, inclusive. Applications should separate printed rolls by a comma or similar. |
| 384 | + |
| 385 | +Create a BIP85 DRNG whose seed is the derived entropy. |
| 386 | + |
| 387 | +Calculate the following integers: |
| 388 | + |
| 389 | + bits_per_roll = ceil(log_2(sides)) |
| 390 | + bytes_per_roll = ceil(bits_per_roll / 8) |
| 391 | +
|
| 392 | +Read <code>bytes_per_roll</code> bytes from the DRNG. |
| 393 | +Trim any bits in excess of <code>bits_per_roll</code> (retain the most |
| 394 | +significant bits). The resulting integer represents a single roll or trial. |
| 395 | +If the trial is greater than or equal to the number of sides, skip it and |
| 396 | +move on to the next one. Repeat as needed until all rolls are complete. |
| 397 | + |
| 398 | +INPUT: |
| 399 | +* MASTER BIP32 ROOT KEY: xprv9s21ZrQH143K2LBWUUQRFXhucrQqBpKdRRxNVq2zBqsx8HVqFk2uYo8kmbaLLHRdqtQpUm98uKfu3vca1LqdGhUtyoFnCNkfmXRyPXLjbKb |
| 400 | +* PATH: m/83696968'/89101'/6'/10'/0' |
| 401 | +OUTPUT |
| 402 | +* DERIVED ENTROPY=5e41f8f5d5d9ac09a20b8a5797a3172b28c806aead00d27e36609e2dd116a59176a738804236586f668da8a51b90c708a4226d7f92259c69f64c51124b6f6cd2 |
| 403 | +* DERIVED ROLLS=1,0,0,2,0,1,5,5,2,4 |
| 404 | +
|
359 | 405 | ==Backwards Compatibility== |
360 | 406 |
|
361 | 407 | This specification is not backwards compatible with any other existing specification. |
|
0 commit comments