LibCrypto: Add LCM functionality to UnsignedBigInteger

This commit is contained in:
devgianlu 2025-06-01 14:31:15 +02:00 committed by Shannon Booth
commit d55f759bbb
Notes: github-actions[bot] 2025-06-25 00:23:14 +00:00
2 changed files with 8 additions and 0 deletions

View file

@ -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())

View file

@ -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;