From 072c4eeb50265a89d9822e62a360257281a0dc0d Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Fri, 27 Oct 2023 01:57:42 +0330 Subject: [PATCH] AK: Make SipHash not depend on size_t bit length That breaks on 32-bit systems, this commit makes it so they're always stored in a u64 as the code requires. --- AK/SipHash.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AK/SipHash.cpp b/AK/SipHash.cpp index d9009ce3f9..fada0b2dcc 100644 --- a/AK/SipHash.cpp +++ b/AK/SipHash.cpp @@ -52,10 +52,11 @@ static void do_siphash(ReadonlyBytes input, u128 key, Bytes output) u64 v1 = 0x646f72616e646f6dull; u64 v2 = 0x6c7967656e657261ull; u64 v3 = 0x7465646279746573ull; - auto const left = input.size() & 7; + u64 const length = input.size(); + auto const left = length & 7; // The end of 64-bit blocks. - auto const block_end = input.size() - (input.size() % sizeof(u64)); - u64 b = input.size() << 56; + auto const block_end = length - (length % sizeof(u64)); + u64 b = length << 56; v3 ^= key.high(); v2 ^= key.low(); v1 ^= key.high();