From 21ba3e4b3149465f3367f0c504882cab172dda52 Mon Sep 17 00:00:00 2001 From: Philip Le Riche <7701190+p-leriche@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:26:34 +0000 Subject: [PATCH] Refactor to use BigIntUtils for parseBigInt function --- src/core/operations/ModularExponentiation.mjs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/core/operations/ModularExponentiation.mjs b/src/core/operations/ModularExponentiation.mjs index 43898d86..64a3bf74 100644 --- a/src/core/operations/ModularExponentiation.mjs +++ b/src/core/operations/ModularExponentiation.mjs @@ -6,6 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; +import { parseBigInt } from "../lib/BigIntUtils.mjs"; /* ---------- helper functions ---------- */ @@ -27,18 +28,6 @@ function modPow(base, exponent, modulus) { return result; } -/** - * parseBigInt helper operation - */ -function parseBigInt(value, param) { - const v = value.trim(); - - if (/^0x[0-9a-f]+$/i.test(v)) return BigInt(v); - if (/^[0-9]+$/.test(v)) return BigInt(v); - - throw new OperationError(param + " must be decimal or hex (0x...)"); -} - /* ---------- operation class ---------- */