mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
Split explanation of encoding formulas
This commit is contained in:
parent
25024a63bc
commit
fbee5e252c
1 changed files with 10 additions and 6 deletions
|
|
@ -179,10 +179,10 @@ apply the encoding for \\( \[2\](\mathcal E) / \mathcal E[2] \\).
|
||||||
|
|
||||||
## The Ristretto Encoding
|
## The Ristretto Encoding
|
||||||
|
|
||||||
We can write the above encoding/decoding procedure concretely (in affine
|
We can write the above encoding/decoding procedure in affine
|
||||||
coordinates) as follows:
|
coordinates as follows:
|
||||||
|
|
||||||
### Encoding
|
### Encoding in Affine Coordinates
|
||||||
|
|
||||||
On input \\( (x,y) \in \[2\](\mathcal E)\\), a representative for a
|
On input \\( (x,y) \in \[2\](\mathcal E)\\), a representative for a
|
||||||
coset in \\( \[2\](\mathcal E) / \mathcal E[4] \\):
|
coset in \\( \[2\](\mathcal E) / \mathcal E[4] \\):
|
||||||
|
|
@ -203,8 +203,12 @@ If \\(\mathcal E\\) has cofactor \\(4\\), we skip the first step,
|
||||||
since our input already represents a coset in
|
since our input already represents a coset in
|
||||||
\\( \[2\](\mathcal E) / \mathcal E[2] \\).
|
\\( \[2\](\mathcal E) / \mathcal E[2] \\).
|
||||||
|
|
||||||
To see that this corresponds to the encoding procedure above, notice
|
### Interpreting the Encoding Procedure
|
||||||
that the first step lifts from \\( \mathcal E / \mathcal E[4] \\) to
|
|
||||||
|
How does this procedure correspond to the description involving
|
||||||
|
\\( \theta \\)?
|
||||||
|
|
||||||
|
The first step lifts from \\( \mathcal E / \mathcal E[4] \\) to
|
||||||
\\(\mathcal E / \mathcal E[2]\\). To understand steps 2 and 3,
|
\\(\mathcal E / \mathcal E[2]\\). To understand steps 2 and 3,
|
||||||
notice that the \\(y\\)-coordinate of \\(\theta(s,t)\\) is
|
notice that the \\(y\\)-coordinate of \\(\theta(s,t)\\) is
|
||||||
$$
|
$$
|
||||||
|
|
@ -232,7 +236,7 @@ sign (by choosing the positive square root). Finally, the check
|
||||||
that \\(y \neq -1\\) prevents division-by-zero when encoding the
|
that \\(y \neq -1\\) prevents division-by-zero when encoding the
|
||||||
identity; it falls out of the optimized formulas below.
|
identity; it falls out of the optimized formulas below.
|
||||||
|
|
||||||
### Decoding
|
### Decoding to Affine Coordinates
|
||||||
|
|
||||||
On input `s_bytes`, decoding proceeds as follows:
|
On input `s_bytes`, decoding proceeds as follows:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue