mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N)
This allows us to support parsing and serializing BigIntegers to and from any base N (such that 2 <= N <= 36).
This commit is contained in:
committed by
Linus Groh
parent
a768131720
commit
005d75656e
Notes:
sideshowbarker
2024-07-18 11:20:46 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/005d75656ef Pull-request: https://github.com/SerenityOS/serenity/pull/8314
@@ -218,7 +218,7 @@ bool is_probably_prime(const UnsignedBigInteger& p)
|
||||
UnsignedBigInteger random_big_prime(size_t bits)
|
||||
{
|
||||
VERIFY(bits >= 33);
|
||||
UnsignedBigInteger min = UnsignedBigInteger::from_base10("6074001000").shift_left(bits - 33);
|
||||
UnsignedBigInteger min = UnsignedBigInteger::from_base(10, "6074001000").shift_left(bits - 33);
|
||||
UnsignedBigInteger max = UnsignedBigInteger { 1 }.shift_left(bits).minus(1);
|
||||
for (;;) {
|
||||
auto p = random_number(min, max);
|
||||
|
||||
Reference in New Issue
Block a user