mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
28 lines
771 B
C++
28 lines
771 B
C++
/*
|
|
* Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Debug.h>
|
|
#include <AK/Random.h>
|
|
#include <LibCrypto/BigInt/Algorithms/UnsignedBigIntegerAlgorithms.h>
|
|
#include <LibCrypto/NumberTheory/ModularFunctions.h>
|
|
#include <LibCrypto/SecureRandom.h>
|
|
|
|
namespace Crypto::NumberTheory {
|
|
|
|
UnsignedBigInteger GCD(UnsignedBigInteger const& a, UnsignedBigInteger const& b)
|
|
{
|
|
UnsignedBigInteger temp_a { a };
|
|
UnsignedBigInteger temp_b { b };
|
|
UnsignedBigInteger temp_quotient;
|
|
UnsignedBigInteger temp_remainder;
|
|
UnsignedBigInteger output;
|
|
|
|
UnsignedBigIntegerAlgorithms::destructive_GCD_without_allocation(temp_a, temp_b, temp_quotient, temp_remainder, output);
|
|
|
|
return output;
|
|
}
|
|
|
|
}
|