Fix 0x parser in old versions of node

This commit is contained in:
Jordi Baylina
2018-10-25 09:42:49 +02:00
parent e73706bacb
commit f122fa202f
2 changed files with 11 additions and 1 deletions

0
cli.js Normal file → Executable file
View File

View File

@@ -206,7 +206,17 @@ if (typeof(BigInt) != "undefined") {
} else {
wBigInt = bigInt;
var oldProto = bigInt.prototype;
wBigInt = function(a) {
if ((typeof a == "string") && (a.slice(0,2) == "0x")) {
return bigInt(a.slice(2), 16);
} else {
return bigInt(a);
}
};
wBigInt.one = bigInt.one;
wBigInt.zero = bigInt.zero;
wBigInt.prototype = oldProto;
// Affine
wBigInt.genAffine = (q) => {