mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibCrypto: Add a += operation to UnsignedBigIntegerAlgorithms
This new operation is immediately used in several existing algorithms.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 18:13:44 +09:00
Author: https://github.com/Dexesttp Commit: https://github.com/SerenityOS/serenity/commit/5071989545a Pull-request: https://github.com/SerenityOS/serenity/pull/7067 Reviewed-by: https://github.com/alimpfard
@@ -26,7 +26,7 @@ void UnsignedBigIntegerAlgorithms::destructive_modular_power_without_allocation(
|
||||
while (!(ep < 1)) {
|
||||
if (ep.words()[0] % 2 == 1) {
|
||||
// exp = (exp * base) % m;
|
||||
multiply_without_allocation(exp, base, temp_1, temp_2, temp_3, temp_4, temp_multiply);
|
||||
multiply_without_allocation(exp, base, temp_1, temp_2, temp_3, temp_multiply);
|
||||
divide_without_allocation(temp_multiply, m, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder);
|
||||
exp.set_to(temp_remainder);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ void UnsignedBigIntegerAlgorithms::destructive_modular_power_without_allocation(
|
||||
ep.set_to(temp_quotient);
|
||||
|
||||
// base = (base * base) % m;
|
||||
multiply_without_allocation(base, base, temp_1, temp_2, temp_3, temp_4, temp_multiply);
|
||||
multiply_without_allocation(base, base, temp_1, temp_2, temp_3, temp_multiply);
|
||||
divide_without_allocation(temp_multiply, m, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder);
|
||||
base.set_to(temp_remainder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user