Encoding

Given a representative in extended coordinates , encoding works as follows where and are the curve parameters as described here.

  1. .

  2. (_ignored, v) = sqrt_ratio_zeta(1, u_1 * (a - d) * X^2).

  3. (sign check 1).

  4. .

  5. .

  6. Set s_bytes to be the canonical unsigned little-endian encoding of , which is an integer mod . s_bytes has extra 0x00 bytes appended to reach a length of 32 bytes.