From 405aa906c5cffb3d7aba8da58ae7a28473806d6c Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 5 Apr 2016 13:18:25 -0400 Subject: [PATCH] short exponent for non-x64 --- Crypto.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Crypto.cpp b/Crypto.cpp index 8416a337..b42dafa6 100644 --- a/Crypto.cpp +++ b/Crypto.cpp @@ -200,8 +200,11 @@ namespace crypto ctx = BN_CTX_new (); // select random k BIGNUM * k = BN_new (); - BN_rand_range (k, elgp); - if (BN_is_zero (k)) BN_one (k); +#if defined(__x86_64__) + BN_rand (k, 2048, -1, 1); // full exponent for x64 +#else + BN_rand (k, 226, -1, 1); // short exponent of 226 bits +#endif // caulculate a a = BN_new (); BN_mod_exp (a, elgg, k, elgp, ctx);