Author

Topic: libsecp256k1: converting a 5x52 field into a 10x26 field (Read 327 times)

legendary
Activity: 1120
Merit: 1037
฿ → ∞
I'm having trouble to achieve a meaningful conversion from a 5x52 field representation to a 10x26 representation.

A mere

Code:
static void hrd256k1_fe_52to26(const hrd256k1_fe *in, hrd256k1_fe32 *out) {
  out->n[1] = in->n[0] & 0x3FFFFFFU;
  out->n[0] = in->n[0] >> 26;
  out->n[3] = in->n[1] & 0x3FFFFFFU;
  out->n[2] = in->n[1] >> 26;
  out->n[5] = in->n[2] & 0x3FFFFFFU;
  out->n[4] = in->n[2] >> 26;
  out->n[7] = in->n[3] & 0x3FFFFFFU;
  out->n[6] = in->n[3] >> 26;
  out->n[9] = in->n[4] & 0x3FFFFFFU;
  out->n[8] = in->n[4] >> 26;
}

doesn't seem to cut it, unless the originating field has been normalized. Am I doing it wrong? Am I overlooking something or should it work and I'm being bitten by something else?


Rico
Jump to: