Convert A Large Integer To a Hex String In Javascript
I need to find a way to convert a large number into a hex string in javascript. Straight off the bat, I tried myBigNumber.toString(16) but if myBigNumber has a very large value (eg 1298925419114529174706173) then myBigNumber.toString(16) will return an erroneous result, which is just brilliant. I tried writing by own function as follows: function (integer) { var result = ''; while (integer) { result = (integer % 16).toString(16) + result; integer = Math.floor(integer / 16); } } However, large numbers modulo 16 all return 0 (I think this fundamental issue is what is causing the problem with