ZhePang / Python_Specification_for_Schnorr_Adaptor

5 stars 4 forks source link

Alternative algorithm for `schnorr_extract_adaptor` #14

Closed siv2r closed 2 months ago

siv2r commented 5 months ago

(Assume we perform $\text{mod} \, n$ everywhere) Let’s define the presignature as:

$$ s = \hat k + H(\mathrm{ R'.x \;||\; msg \;||\; P.x} ) \cdot x $$

where,

$$ \hat{k} = \begin{cases} k & \text{if } R'.y \text{ is even} \ -k & \text{if } R'.y \text{ is odd} \end{cases} $$

Now, We can compute the adaptor from the presignature in two different ways.

Method 1:

$$ T = \begin{cases} R' - \hat{k} \cdot G & \text{if presig[0] is 2} \ -(R' - \hat{k}\cdot G) & \text{if presig[0] is 3} \end{cases} $$

Method 2:

$$ T = \begin{cases} R' - \hat{k} \cdot G & \text{if } R'.y \text{ is even} \ R' + \hat{k}\cdot G & \text{if } R'.y \text{ is odd} \end{cases} $$


We currently follow Method 1, which relies on a presig[0] parity check to compute the adaptor point. This makes things ugly. For instance, our current schnorr_extract_adaptor would still return some garbage T when presig[0] = 4.

I like Method 2 because it won’t rely on such a parity check. It will simply use has_even_y(R').

jonasnick commented 4 months ago

concept ACK