Michael Gronager [ARCHIVE] on Nostr: 📅 Original date posted:2013-05-27 📝 Original message:Pieter, I was re-reading ...
📅 Original date posted:2013-05-27
📝 Original message:Pieter,
I was re-reading BIP0032, and checking some of the equations... It seems
to me that there is something wrong (or I have missed something).
As I see it there can only be one HMAC function, used for both private
and public derivation - I assume that:
[1] CKD((k_par, c_par), i) -> (k_i, c_i)
[2] CKD'((K_par, c_par), i) -> (K_i, c_i)
Where K_par = k_par*G, will result in K_i = k_i*G (and identical c_i's
in both expressions).
Now following your formulas for [1]:
k_i = I_L + k_par (mod n)
where I_L = {HMACSHA512(c_par, 0x00||k_par||i)}_L (denoting left
256bits). Further c_i = I_R.
This gives a K_i = k_i*G = I_L*G + k_par(mod n)*G
Now follow the formula for [2]:
K_i = (I_L+k_par)*G = I_L*G + K_par
This is not the same as above, however, if we remove the (mod n) we are
getting closer, but still the value of I_L are different in the two
equations as: HMACSHA512(c_par, 0x00||k_par||i) <> HMAXSHA512(c_par,
X(k_par*G)||i).
We can, however, fix things if we change private child key derivation to:
To define CDK((k_par, c_par), i) -> (k_i, c_i):
* (no difference in deriving public or private):
I = HMACSHA512(c_par, X(k_par*G)||i)
* Split I into I_L, I_R (256bits each)
* k_i = k_par + I_L
* c_i = I_R
* and, if using public derivation, we use K_i = (k_par + I_L)*G
Now for pure public derivation (i.e. we don't know the private key):
To define CDK'((K_par, c_par), i) -> (K_i, c_i):
* I = HMACSHA512(c_par, X(K_par)||i)
* Split I into I_L and I_R
* K_i = K_par + I_L*G (= k_par*G + I_L*G = (k_par+I_L)*G = k_i*G)
* c_i = I_R
Now we have the right properties, but it required quite some changes,
also note that c_i are now equal in both private and public derivation.
Comments ?
Sincerely,
Michael
Published at
2023-06-07 15:02:28Event JSON
{
"id": "04b4e25e234df17b4a72ff103a532f228ed4fc9f79e357ea99972981a8756642",
"pubkey": "9e3c76fd7eb862ca37f150391debc7baa4f8423eaa3f894c476a7d4360de9a02",
"created_at": 1686150148,
"kind": 1,
"tags": [
[
"e",
"2fa56bdb32cf81261b0dc706ba4e177553eae555a4ac81f318abfd182b69b622",
"",
"reply"
],
[
"p",
"a23dbf6c6cc83e14cc3df4e56cc71845f611908084cfe620e83e40c06ccdd3d0"
]
],
"content": "📅 Original date posted:2013-05-27\n📝 Original message:Pieter,\n\nI was re-reading BIP0032, and checking some of the equations... It seems\nto me that there is something wrong (or I have missed something).\n\nAs I see it there can only be one HMAC function, used for both private\nand public derivation - I assume that:\n[1] CKD((k_par, c_par), i) -\u003e (k_i, c_i)\n[2] CKD'((K_par, c_par), i) -\u003e (K_i, c_i)\n\nWhere K_par = k_par*G, will result in K_i = k_i*G (and identical c_i's\nin both expressions).\n\nNow following your formulas for [1]:\n k_i = I_L + k_par (mod n)\nwhere I_L = {HMACSHA512(c_par, 0x00||k_par||i)}_L (denoting left\n256bits). Further c_i = I_R.\nThis gives a K_i = k_i*G = I_L*G + k_par(mod n)*G\n\nNow follow the formula for [2]:\n K_i = (I_L+k_par)*G = I_L*G + K_par\nThis is not the same as above, however, if we remove the (mod n) we are\ngetting closer, but still the value of I_L are different in the two\nequations as: HMACSHA512(c_par, 0x00||k_par||i) \u003c\u003e HMAXSHA512(c_par,\nX(k_par*G)||i).\n\nWe can, however, fix things if we change private child key derivation to:\n\nTo define CDK((k_par, c_par), i) -\u003e (k_i, c_i):\n* (no difference in deriving public or private):\n\tI = HMACSHA512(c_par, X(k_par*G)||i)\n* Split I into I_L, I_R (256bits each)\n* k_i = k_par + I_L\n* c_i = I_R\n* and, if using public derivation, we use K_i = (k_par + I_L)*G\n\nNow for pure public derivation (i.e. we don't know the private key):\nTo define CDK'((K_par, c_par), i) -\u003e (K_i, c_i):\n* I = HMACSHA512(c_par, X(K_par)||i)\n* Split I into I_L and I_R\n* K_i = K_par + I_L*G (= k_par*G + I_L*G = (k_par+I_L)*G = k_i*G)\n* c_i = I_R\n\nNow we have the right properties, but it required quite some changes,\nalso note that c_i are now equal in both private and public derivation.\n\nComments ?\n\n\nSincerely,\n\nMichael",
"sig": "51dd0f77b8b3a88f9244d2aaf48bf7cbcfc31d400deb34b54953a6ff1272542ad9678cbfc5a5745791060d20b82422962c69668cb30c986986fb1f0f916c0990"
}