Browse Source

use 486662 for A

pull/1491/head
orignal 5 years ago
parent
commit
2877900233
  1. 12
      libi2pd/Elligator.cpp

12
libi2pd/Elligator.cpp

@ -23,11 +23,6 @@ namespace crypto
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
}; };
static const uint8_t A_[32] =
{
0x06, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const uint8_t u_[32] = static const uint8_t u_[32] =
{ {
@ -35,17 +30,18 @@ namespace crypto
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
#define decode_bytes(x) { x = BN_new (); BN_bin2bn (x##_, 32, x); } #define decode_bytes(x) { x = BN_new (); BN_bin2bn (x##_, 32, x); } // TODO: endianess
Elligator2::Elligator2 () Elligator2::Elligator2 ()
{ {
decode_bytes (p); decode_bytes (p);
decode_bytes (n1); decode_bytes (n1);
decode_bytes (n2); decode_bytes (n2);
decode_bytes (A);
decode_bytes (u); decode_bytes (u);
A = BN_new (); BN_set_word (A, 486662);
BN_CTX * ctx = BN_CTX_new (); BN_CTX * ctx = BN_CTX_new ();
BN_mod_inverse (iu, u, p, ctx); iu = BN_new (); BN_mod_inverse (iu, u, p, ctx);
BN_CTX_free (ctx); BN_CTX_free (ctx);
} }

Loading…
Cancel
Save