1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00: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:
Idan Horowitz 2021-06-08 23:43:44 +03:00 committed by Linus Groh
parent 71c54198fa
commit b17a282b4b
4 changed files with 25 additions and 0 deletions

View file

@ -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);