Commit 78997132 authored by Pavol Rusnak's avatar Pavol Rusnak

Merge pull request #3 from gary-rowe/master

Improve wording and provide worked example for SLIP0013 HD section
parents 1964e3cb 86e3f4d9
......@@ -39,15 +39,32 @@ The index is used so one can generate more keys corresponding to the same URI.
##HD Structure
1. Let's concatenate the little endian representation of index with the URI.
1. First concatenate `index` with the URI (`uri`). Use little endian for `index`.
2. Compute the SHA256 hash of the result.
2. Compute the SHA256 hash of the result (`hash`).
3. Let's take first 128 bits of the hash and split it into four 32-bit numbers A, B, C, D.
3. Truncate `hash` to 128 bits (`hash128`)
4. Set highest bits of numbers A, B, C, D to 1.
4. Split `hash128` into four 32-bit integers `A`, `B`, `C`, `D`. Use little endian for each.
5. Derive the HD node m/13'/A'/B'/C'/D' according to BIP32.
5. Set highest bits of numbers `A`, `B`, `C`, `D` to 1 (e.g. logical OR with 0x80000000) to harden
6. Derive the HD node `m/13'/A'/B'/C'/D'` according to BIP32.
###Worked example
1. `index + uri`=`0` + `https://satoshi@bitcoin.org/login`
2. `sha256(index + uri)` = `d0e2389d4c8394a9f3e32de01104bf6e8db2d9e2bb0905d60fffa5a18fd696db`
3. `hash128` = `d0e2389d4c8394a9f3e32de01104bf6e`
4. `A` = 221831888, `B` = 160727884, `C` = 3007475, `D` = 247399441
5. `A'` = 2637750992, `B'` = 2845082444, `C'` = 3761103859, `D'` = 4005495825
6. `bip32 node path` = `m/2147483661/2637750992/2845082444/3761103859/4005495825`
See a [Python example](https://github.com/trezor/python-trezor/blob/ca45019918bc4c54f1ace899a9acf397c8f4d92f/tests/test_msg_signidentity.py#L27).
##Challenge - Response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment