From 811999e08da2c296720cad313f928ef916dd8c8f Mon Sep 17 00:00:00 2001 From: Sean Morris <640101+seanmorris@users.noreply.github.com> Date: Wed, 5 Jan 2022 13:32:22 -0500 Subject: [PATCH] Allowing 0x prefix for hexadecimal numbers. --- lib/BigInteger.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/BigInteger.php b/lib/BigInteger.php index 2ac6dad..ac3afb6 100644 --- a/lib/BigInteger.php +++ b/lib/BigInteger.php @@ -324,6 +324,10 @@ public static function getBC($value = 0, $base = 10) { } if ($base == 16) { $value = str_replace(" ", "", $value); + if(strtolower(substr($value, 0, 2)) === '0x') + { + $value = str_replace("0x", "", $value); + } if (!BigInteger::checkHex($value)) { throw new \Exception("Invalid characters"); }