peterolson / BigInteger.js

An arbitrary length integer library for Javascript
The Unlicense
1.12k stars 187 forks source link

Added parsing of hex string #234

Closed jokumusic closed 2 years ago

jokumusic commented 2 years ago

This is to support parsing of hex strings that begin with 0x or x

peterolson commented 2 years ago

Hex values are already supported via the second argument to bigInt. For example, bigInt("ff", 16).

jokumusic commented 2 years ago

Hex values are already supported via the second argument to bigInt. For example, bigInt("ff", 16).

That doesn't work for packages that expect hexstrings to work. It breaks them... Adding the hex parsing lets them work.

peterolson commented 2 years ago

I haven't looked carefully, but this change potentially break parsing for non-hexadecimal inputs that happen to begin with 0x, such as bigInt("0xaa12", 36)

jokumusic commented 2 years ago

I haven't looked carefully, but this change potentially break parsing for non-hexadecimal inputs that happen to begin with 0x, such as bigInt("0xaa12", 36)

It would break those