mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:27:35 +00: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:
parent
a768131720
commit
005d75656e
14 changed files with 56 additions and 132 deletions
|
@ -62,11 +62,8 @@ public:
|
|||
|
||||
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
|
||||
|
||||
static SignedBigInteger from_base2(StringView str);
|
||||
static SignedBigInteger from_base8(StringView str);
|
||||
static SignedBigInteger from_base10(StringView str);
|
||||
String to_base10() const;
|
||||
static SignedBigInteger from_base16(StringView str);
|
||||
static SignedBigInteger from_base(u16 N, StringView str);
|
||||
String to_base(u16 N) const;
|
||||
|
||||
u64 to_u64() const;
|
||||
|
||||
|
@ -144,5 +141,5 @@ struct SignedDivisionResult {
|
|||
inline Crypto::SignedBigInteger
|
||||
operator""_sbigint(const char* string, size_t length)
|
||||
{
|
||||
return Crypto::SignedBigInteger::from_base10({ string, length });
|
||||
return Crypto::SignedBigInteger::from_base(10, { string, length });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue