How in node.js/JS convert big array with 8-bit values like [28, 27, ... 250] to bignumber representation in string?
Is there a lib for that? I cant find it.
How in node.js/JS convert big array with 8-bit values like [28, 27, ... 250] to bignumber representation in string?
Is there a lib for that? I cant find it.
128 BYTES number ? what ? are you trying to count the number of atoms in the universe or something ?
AFAIU javascript can't handle this. And not any other language I now of. Not any lib I know of.Also Buffer can handle only 64 BIT numbers, not bytes. Which is the usual limit to most languages.
You can't do math in such a large value. If this is just a case of comparing values in a faster way than array loops, what you can do is get a string representation in HEX (cause you can treat bytes separately). Here are a way to get the hex representation:
var arrn = [28, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250];
function bytetohex(byte){
return (byte & 0xFF).toString(16);
}
var n = arrn.reduce((last,curr,ix)=>(ix==1?bytetohex(arrn[0]):last)+bytetohex(curr));
console.log(n);
Edit
If wall you want is RSA decrypt, you could have asked that in the first place. You would have received a response much more quickly. There are several libraries available for that.
This question has some links: Javascript RSA decryption using private key
There is more here: RSA encryption/decryption compatible with Javascript and PHP
And there are plenty of resources on the web for that.