From 984a0d9e78d5e7aafad8683355e3ae389aee9ec2 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 28 Oct 2014 13:06:49 +0300 Subject: [PATCH] Fixed modPow leemon Fixed key generation on BB. Closes #393 --- app/js/lib/bin_utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/js/lib/bin_utils.js b/app/js/lib/bin_utils.js index 709c0e53..47e9e05f 100644 --- a/app/js/lib/bin_utils.js +++ b/app/js/lib/bin_utils.js @@ -561,13 +561,15 @@ function pqPrimeLeemon (what) { function bytesModPow (x, y, m) { try { - var xBigInt = str2bigInt(x, 64), - yBigInt = str2bigInt(y, 64), + var xBigInt = str2bigInt(bytesToHex(x), 16), + yBigInt = str2bigInt(bytesToHex(y), 16), mBigInt = str2bigInt(bytesToHex(m), 16, 2), resBigInt = powMod(xBigInt, yBigInt, mBigInt); return bytesFromHex(bigInt2str(resBigInt, 16)); - } catch (e) {} + } catch (e) { + console.error('mod pow error', e); + } return bytesFromBigInt(new BigInteger(x).modPow(new BigInteger(y), new BigInteger(m))); }