mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibCrypto: Add hash methods to {Signed, Unsigned}BigInteger
These just use hash the underlying bytes that make up the integer words
This commit is contained in:
committed by
Linus Groh
parent
71c54198fa
commit
b17a282b4b
Notes:
sideshowbarker
2024-07-18 12:34:22 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/b17a282b4b0 Pull-request: https://github.com/SerenityOS/serenity/pull/7928 Reviewed-by: https://github.com/linusg
@@ -217,6 +217,11 @@ FLATTEN SignedDivisionResult SignedBigInteger::divided_by(const SignedBigInteger
|
||||
};
|
||||
}
|
||||
|
||||
u32 SignedBigInteger::hash() const
|
||||
{
|
||||
return m_unsigned_data.hash() * (1 - (2 * m_sign));
|
||||
}
|
||||
|
||||
void SignedBigInteger::set_bit_inplace(size_t bit_index)
|
||||
{
|
||||
m_unsigned_data.set_bit_inplace(bit_index);
|
||||
|
||||
Reference in New Issue
Block a user