Skip to content

Commit ba70a74

Browse files
committed
* switch from num_bytes to pwd_len
* always base64 whole 64 bytes of entropy and only then slice out [0:pwd_len] desired password length * example pwd length changed to 21
1 parent 83c5159 commit ba70a74

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

bip-0085.mediawiki

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -265,45 +265,40 @@ OUTPUT
265265
===PWD===
266266
Application number: 707764'
267267

268-
The derivation path format is: <code>m/83696968'/707764'/{num_bytes}'/{index}'</code>
268+
The derivation path format is: <code>m/83696968'/707764'/{pwd_len}'/{index}'</code>
269269

270-
`16 <= num_bytes <= 64`
270+
`20 <= pwd_len <= 86`
271271

272-
Keep left-most `num_bytes` from the generated entropy and [https://datatracker.ietf.org/doc/html/rfc4648 Base64] encode the result.
273-
Remove any spaces or new lines inserted by Base64 encoding process. Resulting password string may contain up to 2 trailing `=` characters (base64 padding)
274-
depending on the value of `num_bytes`. Padding is considered part of the password and should be preserved.
272+
[https://datatracker.ietf.org/doc/html/rfc4648 Base64] encode the all 64 bytes of entropy.
273+
Remove any spaces or new lines inserted by Base64 encoding process. Slice base64 result string
274+
on index 0 to `pwd_len`. This slice is the password. As `pwd_len` is limited to 86, passwords will not contain padding.
275275

276276
Entropy calculation:<br>
277-
R = 64 (do not count padding)<br>
278-
L = pwd_length - num_pad<br>
277+
R = 64 (base64 - do not count padding)<br>
278+
L = pwd_len<br>
279279
Entropy = log2(R ** L)<br>
280280

281281
{| class="wikitable" style="margin:auto"
282-
! num_bytes !! pwd_length !! num_pad !! (cca) entropy
283-
|-
284-
| 17 || 24 || 1 || 138.0
282+
! pwd_length !! (cca) entropy
285283
|-
286-
| 18 || 24 || 0 || 144.0
284+
| 20 || 120.0
287285
|-
288-
| 21 || 28 || 0 || 192.0
286+
| 24 || 144.0
289287
|-
290-
| 32 || 44 || 1 || 258.0
288+
| 32 || 192.0
291289
|-
292-
| 33 || 44 || 0 || 264.0
290+
| 64 || 384.0
293291
|-
294-
| 62 || 84 || 1 || 498.0
295-
|-
296-
| 63 || 84 || 0 || 504.0
292+
| 86 || 516.0
297293
|}
298294

299295
INPUT:
300296
* MASTER BIP32 ROOT KEY: xprv9s21ZrQH143K2LBWUUQRFXhucrQqBpKdRRxNVq2zBqsx8HVqFk2uYo8kmbaLLHRdqtQpUm98uKfu3vca1LqdGhUtyoFnCNkfmXRyPXLjbKb
301-
* PATH: m/83696968'/707764'/17'/0'
297+
* PATH: m/83696968'/707764'/21'/0'
302298
303299
OUTPUT
304300
* DERIVED ENTROPY=d7ad61d4a76575c5bad773feeb40299490b224e8e5df6c8ad8fe3d0a6eed7b85ead9fef7bcca8160f0ee48dc6e92b311fc71f2146623cc6952c03ce82c7b63fe
305-
* DERIVED PWD=161h1KdldcW613P+60AplJA=
306-
301+
* DERIVED PWD=dKLoepugzdVJvdL56ogNV
307302
===RSA===
308303

309304
Application number: 828365'

0 commit comments

Comments
 (0)