mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 23:27:44 +00:00
AK: Use secure SipHash-4-8 for IP addresses
Routing tables formed with IP address hashes should be DoS-resistant.
This commit is contained in:
parent
9a026fc8d5
commit
4cefb02324
2 changed files with 4 additions and 13 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Endian.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/SipHash.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
|
@ -162,7 +163,7 @@ static_assert(sizeof(IPv4Address) == 4);
|
|||
|
||||
template<>
|
||||
struct Traits<IPv4Address> : public GenericTraits<IPv4Address> {
|
||||
static constexpr unsigned hash(IPv4Address const& address) { return int_hash(address.to_u32()); }
|
||||
static unsigned hash(IPv4Address const& address) { return secure_sip_hash(static_cast<u64>(address.to_u32())); }
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue