diff --git a/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 4efa582a9fb..d9f88f547e4 100644 --- a/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -323,6 +323,13 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::gcd(UnsignedBigInteger const& oth return result; } +FLATTEN UnsignedBigInteger UnsignedBigInteger::lcm(UnsignedBigInteger const& other) const +{ + UnsignedBigInteger result; + MP_MUST(mp_lcm(&m_mp, &other.m_mp, &result.m_mp)); + return result; +} + u32 UnsignedBigInteger::hash() const { if (m_hash.has_value()) diff --git a/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index a2ba5d66dbf..85d28261ac7 100644 --- a/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -80,6 +80,7 @@ public: [[nodiscard]] UnsignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const; [[nodiscard]] UnsignedBigInteger pow(u32 exponent) const; [[nodiscard]] UnsignedBigInteger gcd(UnsignedBigInteger const& other) const; + [[nodiscard]] UnsignedBigInteger lcm(UnsignedBigInteger const& other) const; [[nodiscard]] u32 hash() const;