Skip to content

Commit b7f8ea2

Browse files
committed
musig-spec: address robot-dreams' comments
- KeyAggCoeff' -> KeyAggCoeffInternal for consistency - In Sign, add mod n when calculating d - In Tweak, reorder the parameters to (Q, gacc, tacc, tweak, is_xonly) because the first three are "state" arguments - Rename Tweak function to ApplyTweak to avoid confusion with tweak (the vector). This becomes apparent in the python reference code.
1 parent ac477d5 commit b7f8ea2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

doc/musig-spec.mediawiki

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ Input:
214214
* Let ''pk2 = GetSecondKey(pk<sub>1..u</sub>)''
215215
* For ''i = 1 .. u'':
216216
** Let ''P<sub>i</sub> = point(pk<sub>i</sub>)''; fail if that fails.
217-
** Let ''a<sub>i</sub> = KeyAggCoeff'(pk<sub>1..u</sub>, pk<sub>i</sub>, pk2)''.
217+
** Let ''a<sub>i</sub> = KeyAggCoeffInternal(pk<sub>1..u</sub>, pk<sub>i</sub>, pk2)''.
218218
* Let ''Q<sub>0</sub> = a<sub>1</sub>⋅P<sub>1</sub> + a<sub>2</sub>⋅P<sub>1</sub> + ... + a<sub>u</sub>⋅P<sub>u</sub>''
219219
* Fail if ''is_infinite(Q<sub>0</sub>)''.
220220
* Let ''tacc<sub>0</sub> = 0''
221221
* Let ''gacc<sub>0</sub> = 1''
222222
* For ''i = 1 .. v'':
223-
** Let ''(Q<sub>i</sub>, gacc<sub>i</sub>, tacc<sub>i</sub>) = Tweak(Q<sub>i-1</sub>, gacc<sub>i-1</sub>, tweak<sub>i</sub>, tacc<sub>i-1</sub>, is_xonly_t<sub>i</sub>)''; fail if that fails
223+
** Let ''(Q<sub>i</sub>, gacc<sub>i</sub>, tacc<sub>i</sub>) = ApplyTweak(Q<sub>i-1</sub>, gacc<sub>i-1</sub>, tacc<sub>i-1</sub>, tweak<sub>i</sub>, is_xonly_t<sub>i</sub>)''; fail if that fails
224224
* Return ''(Q<sub>v</sub>, gacc<sub>v</sub>, tacc<sub>v</sub>)''.
225225
226226
'''''HashKeys(pk<sub>1..u</sub>)''''':
@@ -234,15 +234,15 @@ Input:
234234
235235
'''''KeyAggCoeff(pk<sub>1..u</sub>, pk')''''':
236236
* Let ''pk2 = GetSecondKey(pk<sub>1..u</sub>)'':
237-
* Return ''KeyAggCoeff'(pk<sub>1..u</sub>, pk', pk2)''
237+
* Return ''KeyAggCoeffInternal(pk<sub>1..u</sub>, pk', pk2)''
238238
239-
'''''KeyAggCoeff'(pk<sub>1..u</sub>, pk', pk2)''''':
239+
'''''KeyAggCoeffInternal(pk<sub>1..u</sub>, pk', pk2)''''':
240240
* Let ''L = HashKeys(pk<sub>1..u</sub>)''
241241
* If ''pk' = pk2'':
242242
** Return 1
243243
* Return ''int(hash<sub>KeyAgg coefficient</sub>(L || pk')) mod n''<ref>The key aggregation coefficient is computed by hashing the public key instead of its index, which requires one more invocation of the SHA-256 compression function. However, it results in significantly simpler implementations because signers do not need to translate between public key indices before and after sorting.</ref>
244244
245-
'''''Tweak(Q<sub>i-1</sub>, gacc<sub>i-1</sub>, tweak<sub>i</sub>, tacc<sub>i-1</sub>, is_xonly_t<sub>i</sub>)''''':
245+
'''''ApplyTweak(Q<sub>i-1</sub>, gacc<sub>i-1</sub>, tacc<sub>i-1</sub>, tweak<sub>i</sub>, is_xonly_t<sub>i</sub>)''''':
246246
* If ''is_xonly_t<sub>i</sub>'' and ''not has_even_y(Q<sub>i-1</sub>)'':
247247
** Let ''g<sub>i-1</sub> = -1 mod n''
248248
* Else: let ''g<sub>i-1</sub> = 1''
@@ -333,7 +333,7 @@ Input:
333333
* Let ''a = GetSessionKeyAggCoeff(session_ctx, P)''; fail if that fails
334334
* Let ''gp = 1'' if ''has_even_y(P)'', otherwise let ''gp = -1 mod n''
335335
* Let ''g<sub>v</sub> = 1'' if ''has_even_y(Q)'', otherwise let ''g<sub>v</sub> = -1 mod n''
336-
* <div id="Sign negation"></div>Let ''d = g<sub>v</sub>⋅gacc<sub>v</sub>⋅gp⋅d' '' (See [[negation-of-the-secret-key-when-signing|Negation Of The Secret Key When Signing]])
336+
* <div id="Sign negation"></div>Let ''d = g<sub>v</sub>⋅gacc<sub>v</sub>⋅gp⋅d' mod n'' (See [[negation-of-the-secret-key-when-signing|Negation Of The Secret Key When Signing]])
337337
* Let ''s = (k<sub>1</sub> + b⋅k<sub>2</sub> + e⋅a⋅d) mod n''
338338
* Let ''psig = bytes(s)''
339339
* Let ''pubnonce = cbytes(k'<sub>1</sub>⋅G) || cbytes(k'<sub>2</sub>⋅G)''
@@ -402,10 +402,10 @@ Input:
402402
* ''P'': a point
403403
* The tweak ''t'': an integer with ''0 &le; t < n ''
404404
405-
'''''OrdinaryTweak(P, t)''''':
405+
'''''ApplyOrdinaryTweak(P, t)''''':
406406
* Return ''P + t⋅G''
407407
408-
'''''XonlyTweak(P, t)''''':
408+
'''''ApplyXonlyTweak(P, t)''''':
409409
* Return ''with_even_y(P) + t⋅G''
410410
411411
=== Negation Of The Secret Key When Signing ===

0 commit comments

Comments
 (0)