mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibCrypto: Move GCD
to method of UnsignedBigInteger
Having it as a method instead of a free function is necessary for the next commits and generally allows for optimizations that require deeper access into the `UnsignedBigInteger`.
This commit is contained in:
parent
e251b451ef
commit
a952d000be
Notes:
github-actions[bot]
2025-05-23 09:58:43 +00:00
Author: https://github.com/devgianlu
Commit: a952d000be
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4507
Reviewed-by: https://github.com/gmta ✅
7 changed files with 15 additions and 33 deletions
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue