Browse Source

Merge branch 'UI-update'

master
Igor Zhukov 10 years ago
parent
commit
9e737854f0
  1. 10
      app/js/lib/bin_utils.js

10
app/js/lib/bin_utils.js

@ -43,9 +43,15 @@ function bytesToHex (bytes) { @@ -43,9 +43,15 @@ function bytesToHex (bytes) {
function bytesFromHex (hexString) {
var len = hexString.length,
i,
start = 0,
bytes = [];
for (i = 0; i < len; i += 2) {
if (hexString.length % 2) {
bytes.push(parseInt(hexString.charAt(0), 16));
start++;
}
for (i = start; i < len; i += 2) {
bytes.push(parseInt(hexString.substr(i, 2), 16));
}
@ -575,7 +581,7 @@ function bytesModPow (x, y, m) { @@ -575,7 +581,7 @@ function bytesModPow (x, y, m) {
try {
var xBigInt = str2bigInt(bytesToHex(x), 16),
yBigInt = str2bigInt(bytesToHex(y), 16),
mBigInt = str2bigInt(bytesToHex(m), 16, 2),
mBigInt = str2bigInt(bytesToHex(m), 16),
resBigInt = powMod(xBigInt, yBigInt, mBigInt);
return bytesFromHex(bigInt2str(resBigInt, 16));

Loading…
Cancel
Save