You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue with determining whether a packet's checksums need recalculation after modifications. Currently, the only options are:
Manually triggering recalculation in every code path where the packet changes, which becomes repetitive and error-prone with complex logic.
Always recalculating all checksums before serialization, which incurs unnecessary performance overhead.
Is there a way to implement automatic checksum recalculation, similar to libraries like PyPacker? For example, by tracking field modifications and recalculating only the affected layer's checksum when changes occur?
Thanks for opening this issue — it’s a valid concern and something I’ve been thinking about as well.
As a first step, I’ve implemented automatic checksum calculation for packet builders. That means when you call .build(), the checksum is computed automatically, ensuring correctness without requiring manual intervention.
As for tracking field changes and triggering automatic recalculation directly within the packet structs — that would require some internal mutation tracking. I’m still evaluating whether that’s a direction I want to pursue, or if we’ll continue recommending the use of builders for safe and reliable packet construction.
Activity
shellrow commentedon Aug 2, 2025
Thanks for opening this issue — it’s a valid concern and something I’ve been thinking about as well.
As a first step, I’ve implemented automatic checksum calculation for packet builders. That means when you call .build(), the checksum is computed automatically, ensuring correctness without requiring manual intervention.
ed2bc2c
As for tracking field changes and triggering automatic recalculation directly within the packet structs — that would require some internal mutation tracking. I’m still evaluating whether that’s a direction I want to pursue, or if we’ll continue recommending the use of builders for safe and reliable packet construction.
shellrow commentedon Nov 9, 2025
Implemented in v0.24.0
All mutable packet types now support optional automatic checksum recomputation.
You can enable it per packet using:
or leave it in manual mode (default).
The library tracks dirty state internally and recomputes only when necessary.
https://github.com/shellrow/nex/releases/tag/v0.24.0