mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-09 16:42:10 +02:00
Up until now, the internet_checksum function lived in IPv4.h. Due to its use in IPv6, a better place for it nowadays would be in IP.h. Due to how it gets used in IPv6 scenarios, it makes sense to extend it to run over multiple smaller structs instead of one big continous chunk of memory. This change converts internet_checksum into a class with methods "add" and "finish", which process data and return the final result, respectively. This commit also fixes proper hash computation for payloads that have an odd length. Furthermore, the function was refactored to use a ReadonlyBytes object instead of separate data and size. Co-Authored-By: Wanda <wanda@phinode.net>
31 KiB
31 KiB