mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 12:30:31 +00:00
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.
This commit is contained in:
parent
01feae24b2
commit
072c4eeb50
Notes:
sideshowbarker
2024-07-17 06:54:15 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/072c4eeb50 Pull-request: https://github.com/SerenityOS/serenity/pull/21592 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/DanShaders
1 changed files with 4 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue